~emersion/soju-dev

soju: db: match placeholders with columns v1 APPLIED

Alexey Yerin: 1
 db: match placeholders with columns

 1 files changed, 1 insertions(+), 1 deletions(-)
#496143 .build.yml success
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/soju-dev/patches/22342/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH soju] db: match placeholders with columns Export this patch

Soju inserts 9 columns but only with 8 placeholders. This causes
channels not being saved properly and also logging errors like this:

    downstream ...: failed to create or update channel ...: 8 values for 9 columns
---
 db.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/db.go b/db.go
index 4147a7c..608e599 100644
--- a/db.go
+++ b/db.go
@@ -596,7 +596,7 @@ func (db *DB) StoreChannel(networkID int64, ch *Channel) error {
	} else {
		var res sql.Result
		res, err = db.db.Exec(`INSERT INTO Channel(network, name, key, detached, detached_internal_msgid, relay_detached, reattach_on, detach_after, detach_on)
			VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,
			VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
			networkID, ch.Name, key, ch.Detached, toNullString(ch.DetachedInternalMsgID), ch.RelayDetached, ch.ReattachOn, detachAfter, ch.DetachOn)
		if err != nil {
			return err
-- 
2.31.1
builds.sr.ht
soju/patches/.build.yml: SUCCESS in 1m42s

[db: match placeholders with columns][0] from [Alexey Yerin][1]

[0]: https://lists.sr.ht/~emersion/soju-dev/patches/22342
[1]: mailto:yyp@disroot.org

✓ #496143 SUCCESS soju/patches/.build.yml https://builds.sr.ht/~emersion/job/496143
Good catch! Thanks for the fix, pushed.