diff --git a/go.mod b/go.mod index 599aec3e7..df1572b4c 100644 --- a/go.mod +++ b/go.mod @@ -23,8 +23,8 @@ require ( github.com/jinzhu/copier v0.4.0 github.com/jmoiron/sqlx v1.4.0 github.com/kisielk/sqlstruct v0.0.0-20210630145711-dae28ed37023 - github.com/lib/pq v1.12.0 - github.com/mattn/go-sqlite3 v1.14.37 + github.com/lib/pq v1.12.3 + github.com/mattn/go-sqlite3 v1.14.42 github.com/mitchellh/mapstructure v1.5.0 github.com/onsi/ginkgo v1.16.5 github.com/onsi/gomega v1.39.1 @@ -37,12 +37,12 @@ require ( github.com/spf13/viper v1.11.0 github.com/stretchr/testify v1.11.1 go.yaml.in/yaml/v3 v3.0.4 - golang.org/x/crypto v0.49.0 + golang.org/x/crypto v0.50.0 ) require ( filippo.io/edwards25519 v1.1.1 // indirect - github.com/Azure/go-ntlmssp v0.1.0 // indirect + github.com/Azure/go-ntlmssp v0.1.1 // indirect github.com/IBM/idemix/bccsp/schemes/weak-bb v0.0.0-20240612072411-114d281b442d // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bits-and-blooms/bitset v1.20.0 // indirect @@ -84,9 +84,9 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect - golang.org/x/net v0.51.0 // indirect - golang.org/x/sys v0.42.0 // indirect - golang.org/x/text v0.35.0 // indirect + golang.org/x/net v0.52.0 // indirect + golang.org/x/sys v0.43.0 // indirect + golang.org/x/text v0.36.0 // indirect google.golang.org/grpc v1.79.3 // indirect google.golang.org/protobuf v1.36.10 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/go.sum b/go.sum index 5354a544d..70e3a5f61 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,8 @@ bitbucket.org/liamstask/goose v0.0.0-20150115234039-8488cc47d90c/go.mod h1:hSVuE filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= filippo.io/edwards25519 v1.1.1 h1:YpjwWWlNmGIDyXOn8zLzqiD+9TyIlPhGFG96P39uBpw= filippo.io/edwards25519 v1.1.1/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= -github.com/Azure/go-ntlmssp v0.1.0 h1:DjFo6YtWzNqNvQdrwEyr/e4nhU3vRiwenz5QX7sFz+A= -github.com/Azure/go-ntlmssp v0.1.0/go.mod h1:NYqdhxd/8aAct/s4qSYZEerdPuH1liG2/X9DiVTbhpk= +github.com/Azure/go-ntlmssp v0.1.1 h1:l+FM/EEMb0U9QZE7mKNEDw5Mu3mFiaa2GKOoTSsNDPw= +github.com/Azure/go-ntlmssp v0.1.1/go.mod h1:NYqdhxd/8aAct/s4qSYZEerdPuH1liG2/X9DiVTbhpk= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/GeertJohan/go.incremental v1.0.0/go.mod h1:6fAjUhbVuX1KcMD3c8TEgVUqmo4seqhv0i0kdATSkM0= github.com/GeertJohan/go.rice v1.0.0/go.mod h1:eH6gbSOAUv07dQuZVnBmoDP8mgsM1rtixis4Tib9if0= @@ -162,14 +162,14 @@ github.com/leanovate/gopter v0.2.11 h1:vRjThO1EKPb/1NsDXuDrzldR28RLkBflWYcU9CvzW github.com/leanovate/gopter v0.2.11/go.mod h1:aK3tzZP/C+p1m3SPRE4SYZFGP7jjkuSI4f7Xvpt0S9c= github.com/lib/pq v0.0.0-20180201184707-88edab080323/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.12.0 h1:mC1zeiNamwKBecjHarAr26c/+d8V5w/u4J0I/yASbJo= -github.com/lib/pq v1.12.0/go.mod h1:/p+8NSbOcwzAEI7wiMXFlgydTwcgTr3OSKMsD2BitpA= +github.com/lib/pq v1.12.3 h1:tTWxr2YLKwIvK90ZXEw8GP7UFHtcbTtty8zsI+YjrfQ= +github.com/lib/pq v1.12.3/go.mod h1:/p+8NSbOcwzAEI7wiMXFlgydTwcgTr3OSKMsD2BitpA= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= -github.com/mattn/go-sqlite3 v1.14.37 h1:3DOZp4cXis1cUIpCfXLtmlGolNLp2VEqhiB/PARNBIg= -github.com/mattn/go-sqlite3 v1.14.37/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= +github.com/mattn/go-sqlite3 v1.14.42 h1:MigqEP4ZmHw3aIdIT7T+9TLa90Z6smwcthx+Azv4Cgo= +github.com/mattn/go-sqlite3 v1.14.42/go.mod h1:pjEuOr8IwzLJP2MfGeTb0A35jauH+C2kbHKBr7yXKVQ= github.com/miekg/pkcs11 v1.1.1 h1:Ugu9pdy6vAYku5DEpVWVFPYnzV+bxB+iRdbuFSu7TvU= github.com/miekg/pkcs11 v1.1.1/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= @@ -281,21 +281,21 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 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.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4= -golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA= +golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI= +golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.33.0 h1:tHFzIWbBifEmbwtGz65eaWyGiGZatSrT9prnU8DbVL8= -golang.org/x/mod v0.33.0/go.mod h1:swjeQEj+6r7fODbD2cqrnje9PnziFuw4bmLbBZFrQ5w= +golang.org/x/mod v0.34.0 h1:xIHgNUUnW6sYkcM5Jleh05DvLOtwc6RitGHbDk4akRI= +golang.org/x/mod v0.34.0/go.mod h1:ykgH52iCZe79kzLLMhyCUzhMci+nQj+0XkbXpNYtVjY= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= -golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= +golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= +golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -313,13 +313,13 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201101102859-da207088b7d1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= -golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI= +golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8= -golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA= +golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= +golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= @@ -327,8 +327,8 @@ golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.42.0 h1:uNgphsn75Tdz5Ji2q36v/nsFSfR/9BRFvqhGBaJGd5k= -golang.org/x/tools v0.42.0/go.mod h1:Ma6lCIwGZvHK6XtgbswSoWroEkhugApmsXyrUmBhfr0= +golang.org/x/tools v0.43.0 h1:12BdW9CeB3Z+J/I/wj34VMl8X+fEXBxVR90JeMX5E7s= +golang.org/x/tools v0.43.0/go.mod h1:uHkMso649BX2cZK6+RpuIPXS3ho2hZo4FVwfoy1vIk0= 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= diff --git a/vendor/github.com/Azure/go-ntlmssp/varfield.go b/vendor/github.com/Azure/go-ntlmssp/varfield.go index 7e2433216..2900a083a 100644 --- a/vendor/github.com/Azure/go-ntlmssp/varfield.go +++ b/vendor/github.com/Azure/go-ntlmssp/varfield.go @@ -14,10 +14,14 @@ type varField struct { } func (f varField) ReadFrom(buffer []byte) ([]byte, error) { - if len(buffer) < int(f.BufferOffset+uint32(f.Len)) { + // f.Len is controlled by the sender, so we need to check that + // it doesn't cause an overflow when added to f.BufferOffset. + start := uint64(f.BufferOffset) + end := start + uint64(f.Len) + if end < start || end > uint64(len(buffer)) { return nil, errors.New("error reading data, varField extends beyond buffer") } - return buffer[f.BufferOffset : f.BufferOffset+uint32(f.Len)], nil + return buffer[int(start):int(end)], nil } func (f varField) ReadStringFrom(buffer []byte, unicode bool) (string, error) { diff --git a/vendor/github.com/lib/pq/CHANGELOG.md b/vendor/github.com/lib/pq/CHANGELOG.md index 3f80d12b2..f0c46a967 100644 --- a/vendor/github.com/lib/pq/CHANGELOG.md +++ b/vendor/github.com/lib/pq/CHANGELOG.md @@ -1,9 +1,32 @@ unreleased ---------- -- This release changes the default `sslmode` from `require` to `prefer`, which - is the default used by libpq and the rest of the PostgreSQL ecosystem. See - [#1271] for some background. + +v1.12.3 (2026-04-03) +-------------------- +- Send datestyle startup parameter, improving compatbility with database engines + that use a different default datestyle such as EnterpriseDB ([#1312]). + +[#1312]: https://github.com/lib/pq/pull/1312 + +v1.12.2 (2026-04-02) +-------------------- + +- Treat io.ErrUnexpectedEOF as driver.ErrBadConn so database/sql discards the + connection. Since v1.12.0 this could result in permanently broken connections, + especially with CockroachDB which frequently sends partial messages ([#1299]). + +[#1299]: https://github.com/lib/pq/pull/1299 + +v1.12.1 (2026-03-30) +-------------------- + +- Look for pgpass file in ~/.pgpass instead of ~/.postgresql/pgpass ([#1300]). + +- Don't clear password if directly set on pq.Config ([#1302]). + +[#1300]: https://github.com/lib/pq/pull/1300 +[#1302]: https://github.com/lib/pq/pull/1302 v1.12.0 (2026-03-18) -------------------- diff --git a/vendor/github.com/lib/pq/README.md b/vendor/github.com/lib/pq/README.md index 5ca523d42..159b86721 100644 --- a/vendor/github.com/lib/pq/README.md +++ b/vendor/github.com/lib/pq/README.md @@ -260,7 +260,7 @@ In addition, your `/etc/hosts` needs an entry: 127.0.0.1 postgres postgres-invalid Or you can use any other PostgreSQL instance; see -`testdata/init/docker-entrypoint-initdb.d` for the required setup. You can use +`testdata/postgres/docker-entrypoint-initdb.d` for the required setup. You can use the standard `PG*` environment variables to control the connection details; it uses the following defaults: diff --git a/vendor/github.com/lib/pq/compose.yaml b/vendor/github.com/lib/pq/compose.yaml index 254344ed7..0092b7e3b 100644 --- a/vendor/github.com/lib/pq/compose.yaml +++ b/vendor/github.com/lib/pq/compose.yaml @@ -6,7 +6,7 @@ services: image: 'cleanstart/pgbouncer:latest' ports: ['127.0.0.1:6432:6432'] command: ['/init/pgbouncer.ini'] - volumes: ['./testdata/init:/init'] + volumes: ['./testdata/pgbouncer:/init', './testdata/ssl:/ssl'] environment: 'PGBOUNCER_DATABASE': 'pqgo' @@ -14,19 +14,27 @@ services: profiles: ['pgpool'] image: 'pgpool/pgpool:4.4.3' ports: ['127.0.0.1:7432:7432'] - volumes: ['./testdata/init:/init'] - entrypoint: '/init/entry-pgpool.sh' + volumes: ['./testdata/pgpool:/init', './testdata/ssl:/ssl'] + entrypoint: '/init/entry.sh' environment: 'PGPOOL_PARAMS_PORT': '7432' 'PGPOOL_PARAMS_BACKEND_HOSTNAME0': 'pg18' + cockroach: + profiles: ['cockroach'] + image: 'cockroachdb/cockroach:latest-v26.1' + ports: ['127.0.0.1:26257:26257'] + volumes: ['./testdata/cockroach:/docker-entrypoint-initdb.d', './testdata/ssl:/ssl'] + command: ['start-single-node', '--accept-sql-without-tls', '--certs-dir=/ssl2'] + healthcheck: {test: ['CMD-SHELL', '/cockroach/cockroach node status --insecure --user=pqgo'], start_period: '30s', start_interval: '1s'} + pg18: image: 'postgres:18' ports: ['127.0.0.1:5432:5432'] entrypoint: '/init/entry.sh' - volumes: ['./testdata/init:/init'] + volumes: ['./testdata/postgres:/init', './testdata/ssl:/ssl'] shm_size: '128mb' - healthcheck: {test: ['CMD-SHELL', 'pg_isready', '-U', 'pqgo', '-d', 'pqgo'], start_period: '30s', start_interval: '1s'} + healthcheck: {test: ['CMD-SHELL', 'pg_isready -U pqgo -d pqgo'], start_period: '30s', start_interval: '1s'} environment: 'POSTGRES_DATABASE': 'pqgo' 'POSTGRES_USER': 'pqgo' @@ -36,9 +44,9 @@ services: image: 'postgres:17' ports: ['127.0.0.1:5432:5432'] entrypoint: '/init/entry.sh' - volumes: ['./testdata/init:/init'] + volumes: ['./testdata/postgres:/init', './testdata/ssl:/ssl'] shm_size: '128mb' - healthcheck: {test: ['CMD-SHELL', 'pg_isready', '-U', 'pqgo', '-d', 'pqgo'], start_period: '30s', start_interval: '1s'} + healthcheck: {test: ['CMD-SHELL', 'pg_isready -U pqgo -d pqgo'], start_period: '30s', start_interval: '1s'} environment: 'POSTGRES_DATABASE': 'pqgo' 'POSTGRES_USER': 'pqgo' @@ -48,9 +56,9 @@ services: image: 'postgres:16' ports: ['127.0.0.1:5432:5432'] entrypoint: '/init/entry.sh' - volumes: ['./testdata/init:/init'] + volumes: ['./testdata/postgres:/init', './testdata/ssl:/ssl'] shm_size: '128mb' - healthcheck: {test: ['CMD-SHELL', 'pg_isready', '-U', 'pqgo', '-d', 'pqgo'], start_period: '30s', start_interval: '1s'} + healthcheck: {test: ['CMD-SHELL', 'pg_isready -U pqgo -d pqgo'], start_period: '30s', start_interval: '1s'} environment: 'POSTGRES_DATABASE': 'pqgo' 'POSTGRES_USER': 'pqgo' @@ -60,9 +68,9 @@ services: image: 'postgres:15' ports: ['127.0.0.1:5432:5432'] entrypoint: '/init/entry.sh' - volumes: ['./testdata/init:/init'] + volumes: ['./testdata/postgres:/init', './testdata/ssl:/ssl'] shm_size: '128mb' - healthcheck: {test: ['CMD-SHELL', 'pg_isready', '-U', 'pqgo', '-d', 'pqgo'], start_period: '30s', start_interval: '1s'} + healthcheck: {test: ['CMD-SHELL', 'pg_isready -U pqgo -d pqgo'], start_period: '30s', start_interval: '1s'} environment: 'POSTGRES_DATABASE': 'pqgo' 'POSTGRES_USER': 'pqgo' @@ -72,9 +80,9 @@ services: image: 'postgres:14' ports: ['127.0.0.1:5432:5432'] entrypoint: '/init/entry.sh' - volumes: ['./testdata/init:/init'] + volumes: ['./testdata/postgres:/init', './testdata/ssl:/ssl'] shm_size: '128mb' - healthcheck: {test: ['CMD-SHELL', 'pg_isready', '-U', 'pqgo', '-d', 'pqgo'], start_period: '30s', start_interval: '1s'} + healthcheck: {test: ['CMD-SHELL', 'pg_isready -U pqgo -d pqgo'], start_period: '30s', start_interval: '1s'} environment: 'POSTGRES_DATABASE': 'pqgo' 'POSTGRES_USER': 'pqgo' diff --git a/vendor/github.com/lib/pq/conn.go b/vendor/github.com/lib/pq/conn.go index d9adc31cb..688329cde 100644 --- a/vendor/github.com/lib/pq/conn.go +++ b/vendor/github.com/lib/pq/conn.go @@ -260,9 +260,6 @@ restartAll: ) for _, cfg := range c.cfg.hosts() { mode := cfg.SSLMode - if mode == "" { - mode = SSLModePrefer - } restartHost: if debugProto { fmt.Fprintln(os.Stderr, "CONNECT ", cfg.string()) @@ -271,7 +268,7 @@ restartAll: cfg.SSLMode = mode cn := &conn{cfg: cfg, dialer: c.dialer} cn.cfg.Password = pgpass.PasswordFromPgpass(cn.cfg.Passfile, cn.cfg.User, cn.cfg.Password, - cn.cfg.Host, strconv.Itoa(int(cn.cfg.Port)), cn.cfg.Database, cn.cfg.isset("password")) + cn.cfg.Host, strconv.Itoa(int(cn.cfg.Port)), cn.cfg.Database) var err error cn.c, err = dial(ctx, c.dialer, cn.cfg) @@ -1240,6 +1237,10 @@ func (cn *conn) startup(cfg Config) error { w.string("client_encoding") w.string(cfg.ClientEncoding) } + if cfg.Datestyle != "" { + w.string("datestyle") + w.string(cfg.Datestyle) + } for k, v := range cfg.Runtime { w.string(k) w.string(v) @@ -1318,13 +1319,13 @@ func (cn *conn) auth(r *readBuf, cfg Config) error { } var token []byte - if cfg.isset("krbspn") { - // Use the supplied SPN if provided.. + if cfg.KrbSpn != "" { + // Use the supplied SPN if provided. token, err = cli.GetInitTokenFromSpn(cfg.KrbSpn) } else { - // Allow the kerberos service name to be overridden + // Allow the kerberos service name to be overridden. service := "postgres" - if cfg.isset("krbsrvname") { + if cfg.KrbSrvname != "" { service = cfg.KrbSrvname } token, err = cli.GetInitToken(cfg.Host, service) diff --git a/vendor/github.com/lib/pq/connector.go b/vendor/github.com/lib/pq/connector.go index 27a268ec5..a2a8fb282 100644 --- a/vendor/github.com/lib/pq/connector.go +++ b/vendor/github.com/lib/pq/connector.go @@ -12,7 +12,6 @@ import ( "os" "path/filepath" "reflect" - "runtime" "slices" "sort" "strconv" @@ -547,7 +546,6 @@ func newConfig(dsn string, env []string) (Config, error) { Host: "localhost", Port: 5432, SSLSNI: true, - SSLMode: SSLModePrefer, MinProtocolVersion: "3.0", MaxProtocolVersion: "3.0", } @@ -689,7 +687,7 @@ func (cfg *Config) fromEnv(env []string) error { return cfg.setFromTag(e, "env", false) } -// parseOpts parses the options from name and adds them to the values. +// fromDSN parses the options from name and adds them to the values. // // The parsing code is based on conninfo_parse from libpq's fe-connect.c func (cfg *Config) fromDSN(dsn string) error { @@ -748,7 +746,7 @@ func (cfg *Config) fromDSN(dsn string) error { // The current character should be = if r != '=' || !ok { - return fmt.Errorf(`missing "=" after %q in connection info string"`, string(keyRunes)) + return fmt.Errorf(`missing "=" after %q in connection info string`, string(keyRunes)) } // Skip any whitespace after the = @@ -801,10 +799,7 @@ func (cfg *Config) fromService() error { } if !cfg.isset("PGSERVICEFILE") { - if home := pqutil.Home(); home != "" { - if runtime.GOOS != "windows" { - home = filepath.Dir(home) // Unlike other files this uses ~/ and not ~/.postgresql - } + if home := pqutil.Home(false); home != "" { cfg.ServiceFile = filepath.Join(home, ".pg_service.conf") } } @@ -979,6 +974,8 @@ func (cfg *Config) setFromTag(o map[string]string, tag string, service bool) err return nil } +// Should generally only be used from newConfig(), as it will never be set if +// people go outside that. func (cfg Config) isset(name string) bool { return slices.Contains(cfg.set, name) } @@ -1041,11 +1038,14 @@ func (cfg Config) string() string { switch k { case "datestyle", "client_encoding": continue - case "host", "port", "user", "sslsni", "sslmode", "min_protocol_version", "max_protocol_version": + case "host", "port", "user", "sslsni", "min_protocol_version", "max_protocol_version": if !cfg.isset(k) { continue } } + if k == "application_name" && m[k] == "pqgo" { + continue + } if k == "host" && len(cfg.multiHost) > 0 { m[k] += "," + strings.Join(cfg.multiHost, ",") } diff --git a/vendor/github.com/lib/pq/copy.go b/vendor/github.com/lib/pq/copy.go index 4c9a8cc7c..a7c73e011 100644 --- a/vendor/github.com/lib/pq/copy.go +++ b/vendor/github.com/lib/pq/copy.go @@ -6,6 +6,7 @@ import ( "encoding/binary" "errors" "fmt" + "os" "sync" "github.com/lib/pq/internal/proto" @@ -121,9 +122,10 @@ func (ci *copyin) flush(buf []byte) error { if len(buf)-1 > proto.MaxUint32 { return errors.New("pq: too many columns") } - // set message length (without message identifier) - binary.BigEndian.PutUint32(buf[1:], uint32(len(buf)-1)) - + if debugProto { + fmt.Fprintf(os.Stderr, "CLIENT → %-20s %5d %q\n", proto.RequestCode(buf[0]), len(buf)-5, buf[5:]) + } + binary.BigEndian.PutUint32(buf[1:], uint32(len(buf)-1)) // Set message length (without message identifier). _, err := ci.cn.c.Write(buf) return err } diff --git a/vendor/github.com/lib/pq/error.go b/vendor/github.com/lib/pq/error.go index 0851a66be..7d061875b 100644 --- a/vendor/github.com/lib/pq/error.go +++ b/vendor/github.com/lib/pq/error.go @@ -307,7 +307,7 @@ func (cn *conn) handleError(reported error, query ...string) error { reported = driver.ErrBadConn } case error: - if err == io.EOF || err.Error() == "remote error: handshake failure" { + if err == io.EOF || err == io.ErrUnexpectedEOF || err.Error() == "remote error: handshake failure" { reported = driver.ErrBadConn } default: diff --git a/vendor/github.com/lib/pq/internal/pgpass/pgpass.go b/vendor/github.com/lib/pq/internal/pgpass/pgpass.go index 002631da7..4da353855 100644 --- a/vendor/github.com/lib/pq/internal/pgpass/pgpass.go +++ b/vendor/github.com/lib/pq/internal/pgpass/pgpass.go @@ -9,9 +9,8 @@ import ( "github.com/lib/pq/internal/pqutil" ) -func PasswordFromPgpass(passfile, user, password, host, port, dbname string, passwordSet bool) string { - // Do not process .pgpass if a password was supplied. - if passwordSet { +func PasswordFromPgpass(passfile, user, password, host, port, dbname string) string { + if password != "" { // Do not process .pgpass if a password was supplied. return password } diff --git a/vendor/github.com/lib/pq/internal/pqutil/path.go b/vendor/github.com/lib/pq/internal/pqutil/path.go index a28fc95f6..dd0d5af0e 100644 --- a/vendor/github.com/lib/pq/internal/pqutil/path.go +++ b/vendor/github.com/lib/pq/internal/pqutil/path.go @@ -19,7 +19,7 @@ import ( // // Matches pqGetHomeDirectory() from PostgreSQL. // https://github.com/postgres/postgres/blob/2b117bb/src/interfaces/libpq/fe-connect.c#L8214 -func Home() string { +func Home(subdir bool) string { if runtime.GOOS == "windows" { // pq uses SHGetFolderPath(), which is deprecated but x/sys/windows has // KnownFolderPath(). We don't really want to pull that in though, so @@ -40,7 +40,12 @@ func Home() string { } home = u.HomeDir } - return filepath.Join(home, ".postgresql") + // libpq reads some files from ~/ and some from ~/.postgresql – on Windows + // it always uses %APPDATA%/postgresql. + if subdir { + home = filepath.Join(home, ".postgresql") + } + return home } // ErrNotExists reports if err is a "path doesn't exist" type error. @@ -62,7 +67,7 @@ var WarnFD io.Writer = os.Stderr func Pgpass(passfile string) string { // Get passfile from the options. if passfile == "" { - home := Home() + home := Home(false) if home == "" { return "" } diff --git a/vendor/github.com/lib/pq/ssl.go b/vendor/github.com/lib/pq/ssl.go index 71b0b288a..b93578546 100644 --- a/vendor/github.com/lib/pq/ssl.go +++ b/vendor/github.com/lib/pq/ssl.go @@ -65,7 +65,7 @@ func getTLSConfigClone(key string) *tls.Config { // in case of sslmode=allow or prefer. func ssl(cfg Config, mode SSLMode) (func(net.Conn) (net.Conn, error), error) { var ( - home = pqutil.Home() + home = pqutil.Home(true) // Don't set defaults here, because tlsConf may be overwritten if a // custom one was registered. Set it after the sslmode switch. tlsConf = &tls.Config{} @@ -82,7 +82,7 @@ func ssl(cfg Config, mode SSLMode) (func(net.Conn) (net.Conn, error), error) { case mode == SSLModeDisable || mode == SSLModeAllow: return nil, nil - case mode == SSLModeRequire || mode == SSLModePrefer: + case mode == "" || mode == SSLModeRequire || mode == SSLModePrefer: // Skip TLS's own verification since it requires full verification. tlsConf.InsecureSkipVerify = true diff --git a/vendor/github.com/mattn/go-sqlite3/sqlite3.go b/vendor/github.com/mattn/go-sqlite3/sqlite3.go index dffc2bda2..1a5433c7e 100644 --- a/vendor/github.com/mattn/go-sqlite3/sqlite3.go +++ b/vendor/github.com/mattn/go-sqlite3/sqlite3.go @@ -78,6 +78,42 @@ _sqlite3_bind_blob(sqlite3_stmt *stmt, int n, void *p, int np) { return sqlite3_bind_blob(stmt, n, p, np, SQLITE_TRANSIENT); } +typedef struct { + int typ; + sqlite3_int64 i64; + double f64; + const void *ptr; + int n; +} sqlite3_go_col; + +static void +_sqlite3_column_values(sqlite3_stmt *stmt, int ncol, sqlite3_go_col *cols) { + for (int i = 0; i < ncol; i++) { + sqlite3_go_col *col = &cols[i]; + col->typ = sqlite3_column_type(stmt, i); + col->ptr = 0; + col->n = 0; + switch (col->typ) { + case SQLITE_INTEGER: + col->i64 = sqlite3_column_int64(stmt, i); + break; + case SQLITE_FLOAT: + col->f64 = sqlite3_column_double(stmt, i); + break; + case SQLITE_BLOB: + col->ptr = sqlite3_column_blob(stmt, i); + col->n = sqlite3_column_bytes(stmt, i); + break; + case SQLITE_TEXT: + col->ptr = sqlite3_column_text(stmt, i); + col->n = sqlite3_column_bytes(stmt, i); + break; + default: + break; + } + } +} + #include #include @@ -90,10 +126,57 @@ _sqlite3_exec(sqlite3* db, const char* pcmd, long long* rowid, long long* change return rv; } +// Combined reset + clear_bindings in a single C call to reduce CGO crossings. +static int +_sqlite3_reset_clear(sqlite3_stmt* stmt) +{ + int rv = sqlite3_reset(stmt); + sqlite3_clear_bindings(stmt); + return rv; +} + #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY extern int _sqlite3_step_blocking(sqlite3_stmt *stmt); extern int _sqlite3_step_row_blocking(sqlite3_stmt* stmt, long long* rowid, long long* changes); extern int _sqlite3_prepare_v2_blocking(sqlite3 *db, const char *zSql, int nBytes, sqlite3_stmt **ppStmt, const char **pzTail); +#endif + +// Combined prepare+step+finalize for simple exec without parameters. +// Reduces CGO crossings from ~6 to 1 for the common no-args exec case. +static int +_sqlite3_exec_no_args(sqlite3* db, const char* zSql, int nBytes, long long* rowid, long long* changes, const char** pzTail) +{ + sqlite3_stmt *stmt = 0; + const char *tail = 0; +#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY + int rv = _sqlite3_prepare_v2_blocking(db, zSql, nBytes, &stmt, &tail); +#else + int rv = sqlite3_prepare_v2(db, zSql, nBytes, &stmt, &tail); +#endif + if (rv != SQLITE_OK) { + *pzTail = 0; + return rv; + } + if (stmt == 0) { + // Empty statement + *rowid = 0; + *changes = 0; + *pzTail = tail; + return SQLITE_OK; + } +#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY + rv = _sqlite3_step_row_blocking(stmt, rowid, changes); +#else + rv = sqlite3_step(stmt); + *rowid = (long long) sqlite3_last_insert_rowid(db); + *changes = (long long) sqlite3_changes(db); +#endif + sqlite3_finalize(stmt); + *pzTail = tail; + return rv; +} + +#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY static int _sqlite3_step_internal(sqlite3_stmt *stmt) @@ -210,6 +293,7 @@ import ( "errors" "fmt" "io" + "math" "net/url" "reflect" "runtime" @@ -361,12 +445,15 @@ type SQLiteDriver struct { // SQLiteConn implements driver.Conn. type SQLiteConn struct { - mu sync.Mutex - db *C.sqlite3 - loc *time.Location - txlock string - funcs []*functionInfo - aggregators []*aggInfo + mu sync.Mutex + db *C.sqlite3 + loc *time.Location + txlock string + funcs []*functionInfo + aggregators []*aggInfo + stmtCache map[string][]*SQLiteStmt + stmtCacheSize int + stmtCacheCount int } // SQLiteTx implements driver.Tx. @@ -376,12 +463,14 @@ type SQLiteTx struct { // SQLiteStmt implements driver.Stmt. type SQLiteStmt struct { - mu sync.Mutex - c *SQLiteConn - s *C.sqlite3_stmt - t string - closed bool - cls bool // True if the statement was created by SQLiteConn.Query + mu sync.Mutex + c *SQLiteConn + s *C.sqlite3_stmt + t string + closed bool + cls bool // True if the statement was created by SQLiteConn.Query + namedParams map[string][3]int + cacheKey string } // SQLiteResult implements sql.Result. @@ -397,6 +486,7 @@ type SQLiteRows struct { cls bool // True if we need to close the parent statement in Close cols []string decltype []string + colvals *C.sqlite3_go_col ctx context.Context // no better alternative to pass context into Next() method closemu sync.Mutex } @@ -847,45 +937,29 @@ func lastError(db *C.sqlite3) error { // Exec implements Execer. func (c *SQLiteConn) Exec(query string, args []driver.Value) (driver.Result, error) { - list := make([]driver.NamedValue, len(args)) - for i, v := range args { - list[i] = driver.NamedValue{ - Ordinal: i + 1, - Value: v, - } - } - return c.exec(context.Background(), query, list) + return c.exec(context.Background(), query, valueToNamedValue(args)) } func (c *SQLiteConn) exec(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) { + // Fast path: no args, no context cancellation → single CGO call per statement + if len(args) == 0 && ctx.Done() == nil { + return c.execNoArgs(query) + } + start := 0 for { - s, err := c.prepare(ctx, query) + s, err := c.prepareWithCache(ctx, query) if err != nil { return nil, err } var res driver.Result if s.(*SQLiteStmt).s != nil { - stmtArgs := make([]driver.NamedValue, 0, len(args)) na := s.NumInput() if len(args)-start < na { s.Close() return nil, fmt.Errorf("not enough args to execute query: want %d got %d", na, len(args)) } - // consume the number of arguments used in the current - // statement and append all named arguments not - // contained therein - if len(args[start:start+na]) > 0 { - stmtArgs = append(stmtArgs, args[start:start+na]...) - for i := range args { - if (i < start || i >= na) && args[i].Name != "" { - stmtArgs = append(stmtArgs, args[i]) - } - } - for i := range stmtArgs { - stmtArgs[i].Ordinal = i + 1 - } - } + stmtArgs := stmtArgs(args, start, na) res, err = s.(*SQLiteStmt).exec(ctx, stmtArgs) if err != nil && err != driver.ErrSkip { s.Close() @@ -906,23 +980,40 @@ func (c *SQLiteConn) exec(ctx context.Context, query string, args []driver.Named } } -// Query implements Queryer. -func (c *SQLiteConn) Query(query string, args []driver.Value) (driver.Rows, error) { - list := make([]driver.NamedValue, len(args)) - for i, v := range args { - list[i] = driver.NamedValue{ - Ordinal: i + 1, - Value: v, +// execNoArgs executes a query with no parameters in a single CGO call per statement. +func (c *SQLiteConn) execNoArgs(query string) (driver.Result, error) { + var res *SQLiteResult + for len(query) > 0 { + var rowid, changes C.longlong + var tail *C.char + pquery := C.CString(query) + rv := C._sqlite3_exec_no_args(c.db, pquery, C.int(len(query)), &rowid, &changes, &tail) + if tail != nil && *tail != '\000' { + query = strings.TrimSpace(C.GoString(tail)) + } else { + query = "" } + C.free(unsafe.Pointer(pquery)) + if rv != C.SQLITE_ROW && rv != C.SQLITE_OK && rv != C.SQLITE_DONE { + return nil, c.lastError() + } + res = &SQLiteResult{id: int64(rowid), changes: int64(changes)} + } + if res == nil { + res = &SQLiteResult{0, 0} } - return c.query(context.Background(), query, list) + return res, nil +} + +// Query implements Queryer. +func (c *SQLiteConn) Query(query string, args []driver.Value) (driver.Rows, error) { + return c.query(context.Background(), query, valueToNamedValue(args)) } func (c *SQLiteConn) query(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error) { start := 0 for { - stmtArgs := make([]driver.NamedValue, 0, len(args)) - s, err := c.prepare(ctx, query) + s, err := c.prepareWithCache(ctx, query) if err != nil { return nil, err } @@ -932,18 +1023,7 @@ func (c *SQLiteConn) query(ctx context.Context, query string, args []driver.Name s.Close() return nil, fmt.Errorf("not enough args to execute query: want %d got %d", na, len(args)-start) } - // consume the number of arguments used in the current - // statement and append all named arguments not contained - // therein - stmtArgs = append(stmtArgs, args[start:start+na]...) - for i := range args { - if (i < start || i >= na) && args[i].Name != "" { - stmtArgs = append(stmtArgs, args[i]) - } - } - for i := range stmtArgs { - stmtArgs[i].Ordinal = i + 1 - } + stmtArgs := stmtArgs(args, start, na) rows, err := s.(*SQLiteStmt).query(ctx, stmtArgs) if err != nil && err != driver.ErrSkip { s.Close() @@ -1109,6 +1189,7 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) { writableSchema := -1 vfsName := "" var cacheSize *int64 + stmtCacheSize := 0 pos := strings.IndexRune(dsn, '?') if pos >= 1 { @@ -1444,6 +1525,20 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) { cacheSize = &iv } + // _stmt_cache_size sets the maximum number of prepared statements + // cached per connection. Note that sql.DB is a connection pool, so + // each connection maintains its own independent cache. + if val := params.Get("_stmt_cache_size"); val != "" { + iv, err := strconv.Atoi(val) + if err != nil { + return nil, fmt.Errorf("Invalid _stmt_cache_size: %v: %v", val, err) + } + if iv < 0 { + return nil, fmt.Errorf("Invalid _stmt_cache_size: %v, expecting non-negative integer", val) + } + stmtCacheSize = iv + } + if val := params.Get("vfs"); val != "" { vfsName = val } @@ -1516,7 +1611,10 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) { // // Create connection to SQLite - conn := &SQLiteConn{db: db, loc: loc, txlock: txlock} + conn := &SQLiteConn{db: db, loc: loc, txlock: txlock, stmtCacheSize: stmtCacheSize} + if stmtCacheSize > 0 { + conn.stmtCache = make(map[string][]*SQLiteStmt) + } // Password Cipher has to be registered before authentication if len(authCrypt) > 0 { @@ -1789,6 +1887,7 @@ func (c *SQLiteConn) Close() error { return nil } runtime.SetFinalizer(c, nil) + c.closeCachedStmtsLocked() rv := C.sqlite3_close_v2(c.db) if rv != C.SQLITE_OK { return lastError(c.db) @@ -1807,6 +1906,70 @@ func (c *SQLiteConn) dbConnOpen() bool { return c.db != nil } +func (c *SQLiteConn) takeCachedStmt(query string) *SQLiteStmt { + if c == nil || query == "" || c.stmtCacheSize <= 0 { + return nil + } + + c.mu.Lock() + defer c.mu.Unlock() + + if c.db == nil { + return nil + } + stmts := c.stmtCache[query] + if len(stmts) == 0 { + return nil + } + s := stmts[len(stmts)-1] + if len(stmts) == 1 { + delete(c.stmtCache, query) + } else { + c.stmtCache[query] = stmts[:len(stmts)-1] + } + c.stmtCacheCount-- + s.closed = false + s.cls = false + s.t = "" + return s +} + +func (c *SQLiteConn) putCachedStmt(s *SQLiteStmt) bool { + if c == nil || s == nil || s.s == nil || s.cacheKey == "" { + return false + } + + c.mu.Lock() + defer c.mu.Unlock() + + if c.db == nil || c.stmtCacheCount >= c.stmtCacheSize { + return false + } + rv := C._sqlite3_reset_clear(s.s) + if rv != C.SQLITE_ROW && rv != C.SQLITE_OK && rv != C.SQLITE_DONE { + return false + } + c.stmtCache[s.cacheKey] = append(c.stmtCache[s.cacheKey], s) + c.stmtCacheCount++ + return true +} + +func (c *SQLiteConn) closeCachedStmtsLocked() { + for key, stmts := range c.stmtCache { + for _, s := range stmts { + if s == nil || s.s == nil { + continue + } + runtime.SetFinalizer(s, nil) + C.sqlite3_finalize(s.s) + s.s = nil + s.c = nil + } + delete(c.stmtCache, key) + } + c.stmtCacheCount = 0 +} + // Prepare the query string. Return a new statement. func (c *SQLiteConn) Prepare(query string) (driver.Stmt, error) { return c.prepare(context.Background(), query) @@ -1817,7 +1980,7 @@ func (c *SQLiteConn) prepare(ctx context.Context, query string) (driver.Stmt, er defer C.free(unsafe.Pointer(pquery)) var s *C.sqlite3_stmt var tail *C.char - rv := C._sqlite3_prepare_v2_internal(c.db, pquery, C.int(-1), &s, &tail) + rv := C._sqlite3_prepare_v2_internal(c.db, pquery, C.int(len(query)), &s, &tail) if rv != C.SQLITE_OK { return nil, c.lastError() } @@ -1830,6 +1993,21 @@ func (c *SQLiteConn) prepare(ctx context.Context, query string) (driver.Stmt, er return ss, nil } +func (c *SQLiteConn) prepareWithCache(ctx context.Context, query string) (driver.Stmt, error) { + if stmt := c.takeCachedStmt(query); stmt != nil { + return stmt, nil + } + stmt, err := c.prepare(ctx, query) + if err != nil { + return nil, err + } + ss := stmt.(*SQLiteStmt) + if ss.t == "" { + ss.cacheKey = query + } + return ss, nil +} + // Run-Time Limit Categories. // See: http://www.sqlite.org/c3ref/c_limit_attached.html const ( @@ -1938,11 +2116,18 @@ func (s *SQLiteStmt) Close() error { runtime.SetFinalizer(s, nil) conn := s.c stmt := s.s - s.s = nil - s.c = nil + if stmt == nil { + s.c = nil + return nil + } if !conn.dbConnOpen() { return errors.New("sqlite statement with already closed database connection") } + if s.cacheKey != "" && conn.putCachedStmt(s) { + return nil + } + s.s = nil + s.c = nil rv := C.sqlite3_finalize(stmt) if rv != C.SQLITE_OK { return conn.lastError() @@ -1957,68 +2142,141 @@ func (s *SQLiteStmt) NumInput() int { var placeHolder = []byte{0} +func bindText(s *C.sqlite3_stmt, n C.int, v string) C.int { + if len(v) == 0 { + return C._sqlite3_bind_text(s, n, (*C.char)(unsafe.Pointer(&placeHolder[0])), C.int(0)) + } + return C._sqlite3_bind_text(s, n, (*C.char)(unsafe.Pointer(unsafe.StringData(v))), C.int(len(v))) +} + +func bindValue(s *C.sqlite3_stmt, n C.int, value driver.Value) C.int { + switch v := value.(type) { + case nil: + return C.sqlite3_bind_null(s, n) + case string: + return bindText(s, n, v) + case int64: + return C.sqlite3_bind_int64(s, n, C.sqlite3_int64(v)) + case bool: + if v { + return C.sqlite3_bind_int(s, n, 1) + } + return C.sqlite3_bind_int(s, n, 0) + case float64: + return C.sqlite3_bind_double(s, n, C.double(v)) + case []byte: + if v == nil { + return C.sqlite3_bind_null(s, n) + } + ln := len(v) + if ln == 0 { + v = placeHolder + } + return C._sqlite3_bind_blob(s, n, unsafe.Pointer(&v[0]), C.int(ln)) + case time.Time: + var buf [64]byte + b := v.AppendFormat(buf[:0], SQLiteTimestampFormats[0]) + if len(b) == 0 { + return C._sqlite3_bind_text(s, n, (*C.char)(unsafe.Pointer(&placeHolder[0])), C.int(0)) + } + return C._sqlite3_bind_text(s, n, (*C.char)(unsafe.Pointer(&b[0])), C.int(len(b))) + default: + return C.SQLITE_MISUSE + } +} + +func (s *SQLiteStmt) bindNamedIndices(name string) [3]int { + if s.namedParams == nil { + s.namedParams = make(map[string][3]int) + } else if indices, ok := s.namedParams[name]; ok { + return indices + } + + // Build ":name\0" once and rewrite prefix byte to avoid 3 C.CString allocs. + buf := make([]byte, 1+len(name)+1) // prefix + name + null terminator + copy(buf[1:], name) + buf[len(buf)-1] = 0 + cname := (*C.char)(unsafe.Pointer(&buf[0])) + + var indices [3]int + prefixes := [3]byte{':', '@', '$'} + for i, p := range prefixes { + buf[0] = p + indices[i] = int(C.sqlite3_bind_parameter_index(s.s, cname)) + } + s.namedParams[name] = indices + return indices +} + +func stmtArgs(args []driver.NamedValue, start, na int) []driver.NamedValue { + if na == 0 { + return nil + } + + end := start + na + hasNamedOutside := false + for i := range args { + if args[i].Name != "" && (i < start || i >= end) { + hasNamedOutside = true + break + } + } + if start == 0 && !hasNamedOutside { + return args[start:end] + } + + stmtArgs := make([]driver.NamedValue, 0, len(args)) + stmtArgs = append(stmtArgs, args[start:end]...) + for i := range args { + if args[i].Name != "" && (i < start || i >= end) { + stmtArgs = append(stmtArgs, args[i]) + } + } + for i := range stmtArgs { + stmtArgs[i].Ordinal = i + 1 + } + return stmtArgs +} + func (s *SQLiteStmt) bind(args []driver.NamedValue) error { - rv := C.sqlite3_reset(s.s) + rv := C._sqlite3_reset_clear(s.s) if rv != C.SQLITE_ROW && rv != C.SQLITE_OK && rv != C.SQLITE_DONE { return s.c.lastError() } - C.sqlite3_clear_bindings(s.s) + hasNamed := false + for i := range args { + if args[i].Name != "" { + hasNamed = true + break + } + } - bindIndices := make([][3]int, len(args)) - prefixes := []string{":", "@", "$"} - for i, v := range args { - bindIndices[i][0] = args[i].Ordinal - if v.Name != "" { - for j := range prefixes { - cname := C.CString(prefixes[j] + v.Name) - bindIndices[i][j] = int(C.sqlite3_bind_parameter_index(s.s, cname)) - C.free(unsafe.Pointer(cname)) + if !hasNamed { + for _, arg := range args { + n := C.int(arg.Ordinal) + rv = bindValue(s.s, n, arg.Value) + if rv != C.SQLITE_OK { + return s.c.lastError() } - args[i].Ordinal = bindIndices[i][0] } + return nil } - for i, arg := range args { - for j := range bindIndices[i] { - if bindIndices[i][j] == 0 { - continue + for _, arg := range args { + if arg.Name == "" { + rv = bindValue(s.s, C.int(arg.Ordinal), arg.Value) + if rv != C.SQLITE_OK { + return s.c.lastError() } - n := C.int(bindIndices[i][j]) - switch v := arg.Value.(type) { - case nil: - rv = C.sqlite3_bind_null(s.s, n) - case string: - if len(v) == 0 { - rv = C._sqlite3_bind_text(s.s, n, (*C.char)(unsafe.Pointer(&placeHolder[0])), C.int(0)) - } else { - b := []byte(v) - rv = C._sqlite3_bind_text(s.s, n, (*C.char)(unsafe.Pointer(&b[0])), C.int(len(b))) - } - case int64: - rv = C.sqlite3_bind_int64(s.s, n, C.sqlite3_int64(v)) - case bool: - if v { - rv = C.sqlite3_bind_int(s.s, n, 1) - } else { - rv = C.sqlite3_bind_int(s.s, n, 0) - } - case float64: - rv = C.sqlite3_bind_double(s.s, n, C.double(v)) - case []byte: - if v == nil { - rv = C.sqlite3_bind_null(s.s, n) - } else { - ln := len(v) - if ln == 0 { - v = placeHolder - } - rv = C._sqlite3_bind_blob(s.s, n, unsafe.Pointer(&v[0]), C.int(ln)) - } - case time.Time: - b := []byte(v.Format(SQLiteTimestampFormats[0])) - rv = C._sqlite3_bind_text(s.s, n, (*C.char)(unsafe.Pointer(&b[0])), C.int(len(b))) + continue + } + indices := s.bindNamedIndices(arg.Name) + for _, idx := range indices { + if idx == 0 { + continue } + rv = bindValue(s.s, C.int(idx), arg.Value) if rv != C.SQLITE_OK { return s.c.lastError() } @@ -2029,14 +2287,7 @@ func (s *SQLiteStmt) bind(args []driver.NamedValue) error { // Query the statement with arguments. Return records. func (s *SQLiteStmt) Query(args []driver.Value) (driver.Rows, error) { - list := make([]driver.NamedValue, len(args)) - for i, v := range args { - list[i] = driver.NamedValue{ - Ordinal: i + 1, - Value: v, - } - } - return s.query(context.Background(), list) + return s.query(context.Background(), valueToNamedValue(args)) } func (s *SQLiteStmt) query(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) { @@ -2050,8 +2301,15 @@ func (s *SQLiteStmt) query(ctx context.Context, args []driver.NamedValue) (drive cls: s.cls, cols: nil, decltype: nil, + colvals: nil, ctx: ctx, } + if rows.nc > 0 { + rows.colvals = (*C.sqlite3_go_col)(C.malloc(C.size_t(rows.nc) * C.size_t(unsafe.Sizeof(C.sqlite3_go_col{})))) + if rows.colvals == nil { + return nil, errors.New("sqlite3: failed to allocate row buffer") + } + } return rows, nil } @@ -2068,6 +2326,10 @@ func (r *SQLiteResult) RowsAffected() (int64, error) { // Exec execute the statement with arguments. Return result object. func (s *SQLiteStmt) Exec(args []driver.Value) (driver.Result, error) { + return s.exec(context.Background(), valueToNamedValue(args)) +} + +func valueToNamedValue(args []driver.Value) []driver.NamedValue { list := make([]driver.NamedValue, len(args)) for i, v := range args { list[i] = driver.NamedValue{ @@ -2075,7 +2337,7 @@ func (s *SQLiteStmt) Exec(args []driver.Value) (driver.Result, error) { Value: v, } } - return s.exec(context.Background(), list) + return list } func isInterruptErr(err error) bool { @@ -2092,38 +2354,35 @@ func (s *SQLiteStmt) exec(ctx context.Context, args []driver.NamedValue) (driver return s.execSync(args) } - type result struct { - r driver.Result - err error - } - resultCh := make(chan result) - defer close(resultCh) + sema := make(chan struct{}) + var r driver.Result + var err error go func() { - r, err := s.execSync(args) - resultCh <- result{r, err} + r, err = s.execSync(args) + close(sema) }() - var rv result select { - case rv = <-resultCh: + case <-sema: + return r, err case <-ctx.Done(): select { - case rv = <-resultCh: // no need to interrupt, operation completed in db + case <-sema: // no need to interrupt, operation completed in db + return r, err default: // this is still racy and can be no-op if executed between sqlite3_* calls in execSync. C.sqlite3_interrupt(s.c.db) - rv = <-resultCh // wait for goroutine completed - if isInterruptErr(rv.err) { + <-sema // wait for goroutine completed + if isInterruptErr(err) { return nil, ctx.Err() } + return r, err } } - return rv.r, rv.err } func (s *SQLiteStmt) execSync(args []driver.NamedValue) (driver.Result, error) { if err := s.bind(args); err != nil { - C.sqlite3_reset(s.s) - C.sqlite3_clear_bindings(s.s) + C._sqlite3_reset_clear(s.s) return nil, err } @@ -2131,8 +2390,7 @@ func (s *SQLiteStmt) execSync(args []driver.NamedValue) (driver.Result, error) { rv := C._sqlite3_step_row_internal(s.s, &rowid, &changes) if rv != C.SQLITE_ROW && rv != C.SQLITE_OK && rv != C.SQLITE_DONE { err := s.c.lastError() - C.sqlite3_reset(s.s) - C.sqlite3_clear_bindings(s.s) + C._sqlite3_reset_clear(s.s) return nil, err } @@ -2152,9 +2410,17 @@ func (rc *SQLiteRows) Close() error { defer rc.closemu.Unlock() s := rc.s if s == nil { + if rc.colvals != nil { + C.free(unsafe.Pointer(rc.colvals)) + rc.colvals = nil + } return nil } rc.s = nil // remove reference to SQLiteStmt + if rc.colvals != nil { + C.free(unsafe.Pointer(rc.colvals)) + rc.colvals = nil + } s.mu.Lock() if s.closed { s.mu.Unlock() @@ -2179,7 +2445,7 @@ func (rc *SQLiteRows) Columns() []string { defer rc.s.mu.Unlock() if rc.s.s != nil && int(rc.nc) != len(rc.cols) { rc.cols = make([]string, rc.nc) - for i := 0; i < int(rc.nc); i++ { + for i := range rc.cols { rc.cols[i] = C.GoString(C.sqlite3_column_name(rc.s.s, C.int(i))) } } @@ -2189,7 +2455,7 @@ func (rc *SQLiteRows) Columns() []string { func (rc *SQLiteRows) declTypes() []string { if rc.s.s != nil && rc.decltype == nil { rc.decltype = make([]string, rc.nc) - for i := 0; i < int(rc.nc); i++ { + for i := range rc.decltype { rc.decltype[i] = strings.ToLower(C.GoString(C.sqlite3_column_decltype(rc.s.s, C.int(i)))) } } @@ -2215,21 +2481,22 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error { if rc.ctx.Done() == nil { return rc.nextSyncLocked(dest) } - resultCh := make(chan error) - defer close(resultCh) + sema := make(chan struct{}) + var err error go func() { - resultCh <- rc.nextSyncLocked(dest) + err = rc.nextSyncLocked(dest) + close(sema) }() select { - case err := <-resultCh: + case <-sema: return err case <-rc.ctx.Done(): select { - case <-resultCh: // no need to interrupt + case <-sema: // no need to interrupt default: // this is still racy and can be no-op if executed between sqlite3_* calls in nextSyncLocked. C.sqlite3_interrupt(rc.s.c.db) - <-resultCh // ensure goroutine completed + <-sema // ensure goroutine completed } return rc.ctx.Err() } @@ -2250,12 +2517,20 @@ func (rc *SQLiteRows) nextSyncLocked(dest []driver.Value) error { } rc.declTypes() + if len(dest) == 0 { + return nil + } + C._sqlite3_column_values(rc.s.s, C.int(len(dest)), rc.colvals) + colvals := (*[(math.MaxInt32 - 1) / unsafe.Sizeof(C.sqlite3_go_col{})]C.sqlite3_go_col)(unsafe.Pointer(rc.colvals))[:len(dest):len(dest)] + decltype := rc.decltype + _ = decltype[len(dest)-1] for i := range dest { - switch C.sqlite3_column_type(rc.s.s, C.int(i)) { + col := &colvals[i] + switch col.typ { case C.SQLITE_INTEGER: - val := int64(C.sqlite3_column_int64(rc.s.s, C.int(i))) - switch rc.decltype[i] { + val := int64(col.i64) + switch decltype[i] { case columnTimestamp, columnDatetime, columnDate: var t time.Time // Assume a millisecond unix timestamp if it's 13 digits -- too @@ -2277,14 +2552,14 @@ func (rc *SQLiteRows) nextSyncLocked(dest []driver.Value) error { dest[i] = val } case C.SQLITE_FLOAT: - dest[i] = float64(C.sqlite3_column_double(rc.s.s, C.int(i))) + dest[i] = float64(col.f64) case C.SQLITE_BLOB: - p := C.sqlite3_column_blob(rc.s.s, C.int(i)) + p := col.ptr if p == nil { dest[i] = []byte{} continue } - n := C.sqlite3_column_bytes(rc.s.s, C.int(i)) + n := col.n dest[i] = C.GoBytes(p, n) case C.SQLITE_NULL: dest[i] = nil @@ -2292,10 +2567,10 @@ func (rc *SQLiteRows) nextSyncLocked(dest []driver.Value) error { var err error var timeVal time.Time - n := int(C.sqlite3_column_bytes(rc.s.s, C.int(i))) - s := C.GoStringN((*C.char)(unsafe.Pointer(C.sqlite3_column_text(rc.s.s, C.int(i)))), C.int(n)) + n := int(col.n) + s := C.GoStringN((*C.char)(unsafe.Pointer(col.ptr)), C.int(n)) - switch rc.decltype[i] { + switch decltype[i] { case columnTimestamp, columnDatetime, columnDate: var t time.Time s = strings.TrimSuffix(s, "Z") diff --git a/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_vtable.go b/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_vtable.go index 9b164b3e0..9761bf357 100644 --- a/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_vtable.go +++ b/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_vtable.go @@ -301,10 +301,18 @@ const ( OpLT = 16 OpGE = 32 OpMATCH = 64 - OpLIKE = 65 /* 3.10.0 and later only */ - OpGLOB = 66 /* 3.10.0 and later only */ - OpREGEXP = 67 /* 3.10.0 and later only */ - OpScanUnique = 1 /* Scan visits at most 1 row */ + OpLIKE = 65 /* 3.10.0 and later only */ + OpGLOB = 66 /* 3.10.0 and later only */ + OpREGEXP = 67 /* 3.10.0 and later only */ + OpNE = 68 /* 3.21.0 and later only */ + OpISNOT = 69 /* 3.21.0 and later */ + OpISNOTNULL = 70 /* 3.21.0 and later */ + OpISNULL = 71 /* 3.21.0 and later */ + OpIS = 72 /* 3.21.0 and later */ + OpLIMIT = 73 /* 3.38.0 and later */ + OpOFFSET = 74 /* 3.38.0 and later */ + OpFUNCTION = 150 /* 3.25.0 and later */ + OpScanUnique = 1 /* Scan visits at most 1 row */ ) // InfoConstraint give information of constraint. diff --git a/vendor/github.com/mattn/go-sqlite3/sqlite3_go18.go b/vendor/github.com/mattn/go-sqlite3/sqlite3_sql.go similarity index 97% rename from vendor/github.com/mattn/go-sqlite3/sqlite3_go18.go rename to vendor/github.com/mattn/go-sqlite3/sqlite3_sql.go index 34cad08e4..47c522f48 100644 --- a/vendor/github.com/mattn/go-sqlite3/sqlite3_go18.go +++ b/vendor/github.com/mattn/go-sqlite3/sqlite3_sql.go @@ -3,15 +3,14 @@ // Use of this source code is governed by an MIT-style // license that can be found in the LICENSE file. -//go:build cgo && go1.8 -// +build cgo,go1.8 +//go:build cgo +// +build cgo package sqlite3 import ( - "database/sql/driver" - "context" + "database/sql/driver" ) // Ping implement Pinger. diff --git a/vendor/golang.org/x/sys/cpu/cpu_darwin_arm64_other.go b/vendor/golang.org/x/sys/cpu/cpu_darwin_arm64_other.go index 4ee68e38d..37ecc6644 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_darwin_arm64_other.go +++ b/vendor/golang.org/x/sys/cpu/cpu_darwin_arm64_other.go @@ -6,6 +6,8 @@ package cpu +import "runtime" + func doinit() { setMinimalFeatures() diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go index 6c7c5bfd5..53f814d7a 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_other_arm64.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 && !linux && !netbsd && !openbsd && !windows && arm64 +//go:build !darwin && !linux && !netbsd && !openbsd && arm64 package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_windows_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_windows_arm64.go deleted file mode 100644 index d09e85a36..000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_windows_arm64.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2026 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 cpu - -import ( - "golang.org/x/sys/windows" -) - -func doinit() { - // set HasASIMD and HasFP to true as per - // https://learn.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-170#base-requirements - // - // The ARM64 version of Windows always presupposes that it's running on an ARMv8 or later architecture. - // Both floating-point and NEON support are presumed to be present in hardware. - // - ARM64.HasASIMD = true - ARM64.HasFP = true - - if windows.IsProcessorFeaturePresent(windows.PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE) { - ARM64.HasAES = true - ARM64.HasPMULL = true - ARM64.HasSHA1 = true - ARM64.HasSHA2 = true - } - ARM64.HasSHA3 = windows.IsProcessorFeaturePresent(windows.PF_ARM_SHA3_INSTRUCTIONS_AVAILABLE) - ARM64.HasCRC32 = windows.IsProcessorFeaturePresent(windows.PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE) - ARM64.HasSHA512 = windows.IsProcessorFeaturePresent(windows.PF_ARM_SHA512_INSTRUCTIONS_AVAILABLE) - ARM64.HasATOMICS = windows.IsProcessorFeaturePresent(windows.PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE) - if windows.IsProcessorFeaturePresent(windows.PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE) { - ARM64.HasASIMDDP = true - ARM64.HasASIMDRDM = true - } - if windows.IsProcessorFeaturePresent(windows.PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE) { - ARM64.HasLRCPC = true - ARM64.HasSM3 = true - } - ARM64.HasSVE = windows.IsProcessorFeaturePresent(windows.PF_ARM_SVE_INSTRUCTIONS_AVAILABLE) - ARM64.HasSVE2 = windows.IsProcessorFeaturePresent(windows.PF_ARM_SVE2_INSTRUCTIONS_AVAILABLE) - ARM64.HasJSCVT = windows.IsProcessorFeaturePresent(windows.PF_ARM_V83_JSCVT_INSTRUCTIONS_AVAILABLE) -} diff --git a/vendor/golang.org/x/sys/windows/dll_windows.go b/vendor/golang.org/x/sys/windows/dll_windows.go index 3ca814f54..1157b06d8 100644 --- a/vendor/golang.org/x/sys/windows/dll_windows.go +++ b/vendor/golang.org/x/sys/windows/dll_windows.go @@ -163,42 +163,7 @@ func (p *Proc) Addr() uintptr { // (according to the semantics of the specific function being called) before consulting // the error. The error will be guaranteed to contain windows.Errno. func (p *Proc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error) { - switch len(a) { - case 0: - return syscall.Syscall(p.Addr(), uintptr(len(a)), 0, 0, 0) - case 1: - return syscall.Syscall(p.Addr(), uintptr(len(a)), a[0], 0, 0) - case 2: - return syscall.Syscall(p.Addr(), uintptr(len(a)), a[0], a[1], 0) - case 3: - return syscall.Syscall(p.Addr(), uintptr(len(a)), a[0], a[1], a[2]) - case 4: - return syscall.Syscall6(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], 0, 0) - case 5: - return syscall.Syscall6(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], 0) - case 6: - return syscall.Syscall6(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5]) - case 7: - return syscall.Syscall9(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], 0, 0) - case 8: - return syscall.Syscall9(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], 0) - case 9: - return syscall.Syscall9(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]) - case 10: - return syscall.Syscall12(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], 0, 0) - case 11: - return syscall.Syscall12(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], 0) - case 12: - return syscall.Syscall12(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11]) - case 13: - return syscall.Syscall15(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], 0, 0) - case 14: - return syscall.Syscall15(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], 0) - case 15: - return syscall.Syscall15(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14]) - default: - panic("Call " + p.Name + " with too many arguments " + itoa(len(a)) + ".") - } + return syscall.SyscallN(p.Addr(), a...) } // A LazyDLL implements access to a single DLL. diff --git a/vendor/golang.org/x/sys/windows/security_windows.go b/vendor/golang.org/x/sys/windows/security_windows.go index a8b0364c7..6c955cea1 100644 --- a/vendor/golang.org/x/sys/windows/security_windows.go +++ b/vendor/golang.org/x/sys/windows/security_windows.go @@ -1438,13 +1438,17 @@ func GetSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformati } // GetNamedSecurityInfo queries the security information for a given named object and returns the self-relative security -// descriptor result on the Go heap. +// descriptor result on the Go heap. The security descriptor might be nil, even when err is nil, if the object exists +// but has no security descriptor. func GetNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION) (sd *SECURITY_DESCRIPTOR, err error) { var winHeapSD *SECURITY_DESCRIPTOR err = getNamedSecurityInfo(objectName, objectType, securityInformation, nil, nil, nil, nil, &winHeapSD) if err != nil { return } + if winHeapSD == nil { + return nil, nil + } defer LocalFree(Handle(unsafe.Pointer(winHeapSD))) return winHeapSD.copySelfRelativeSecurityDescriptor(), nil } diff --git a/vendor/modules.txt b/vendor/modules.txt index af373ed27..c433083d4 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -2,7 +2,7 @@ ## explicit; go 1.20 filippo.io/edwards25519 filippo.io/edwards25519/field -# github.com/Azure/go-ntlmssp v0.1.0 +# github.com/Azure/go-ntlmssp v0.1.1 ## explicit; go 1.24 github.com/Azure/go-ntlmssp github.com/Azure/go-ntlmssp/internal/md4 @@ -215,7 +215,7 @@ github.com/kilic/bls12-381 # github.com/kisielk/sqlstruct v0.0.0-20210630145711-dae28ed37023 ## explicit github.com/kisielk/sqlstruct -# github.com/lib/pq v1.12.0 +# github.com/lib/pq v1.12.3 ## explicit; go 1.21 github.com/lib/pq github.com/lib/pq/internal/pgpass @@ -230,8 +230,8 @@ github.com/lib/pq/scram # github.com/magiconair/properties v1.8.7 ## explicit; go 1.19 github.com/magiconair/properties -# github.com/mattn/go-sqlite3 v1.14.37 -## explicit; go 1.19 +# github.com/mattn/go-sqlite3 v1.14.42 +## explicit; go 1.21 github.com/mattn/go-sqlite3 # github.com/miekg/pkcs11 v1.1.1 ## explicit; go 1.12 @@ -407,7 +407,7 @@ go.yaml.in/yaml/v2 # go.yaml.in/yaml/v3 v3.0.4 ## explicit; go 1.16 go.yaml.in/yaml/v3 -# golang.org/x/crypto v0.49.0 +# golang.org/x/crypto v0.50.0 ## explicit; go 1.25.0 golang.org/x/crypto/bcrypt golang.org/x/crypto/blake2b @@ -419,7 +419,7 @@ golang.org/x/crypto/md4 golang.org/x/crypto/ocsp golang.org/x/crypto/pkcs12 golang.org/x/crypto/pkcs12/internal/rc2 -# golang.org/x/net v0.51.0 +# golang.org/x/net v0.52.0 ## explicit; go 1.25.0 golang.org/x/net/context golang.org/x/net/context/ctxhttp @@ -427,12 +427,12 @@ golang.org/x/net/html golang.org/x/net/html/atom golang.org/x/net/html/charset golang.org/x/net/idna -# golang.org/x/sys v0.42.0 +# golang.org/x/sys v0.43.0 ## explicit; go 1.25.0 golang.org/x/sys/cpu golang.org/x/sys/unix golang.org/x/sys/windows -# golang.org/x/text v0.35.0 +# golang.org/x/text v0.36.0 ## explicit; go 1.25.0 golang.org/x/text/encoding golang.org/x/text/encoding/charmap