From 6e90239fefbcbd7522a5b1aec492c2c3365a48f6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= <pubgit@mikescher.com>
Date: Fri, 29 Dec 2023 18:06:45 +0100
Subject: [PATCH] v0.0.350

---
 goextVersion.go |  4 ++--
 sq/hasher.go    | 32 +++++++++++++++++++++++++++++++-
 2 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/goextVersion.go b/goextVersion.go
index 25aa19c..6d19037 100644
--- a/goextVersion.go
+++ b/goextVersion.go
@@ -1,5 +1,5 @@
 package goext
 
-const GoextVersion = "0.0.349"
+const GoextVersion = "0.0.350"
 
-const GoextVersionTimestamp = "2023-12-28T01:36:21+0100"
+const GoextVersionTimestamp = "2023-12-29T18:06:45+0100"
diff --git a/sq/hasher.go b/sq/hasher.go
index f272d5a..3bd0019 100644
--- a/sq/hasher.go
+++ b/sq/hasher.go
@@ -13,7 +13,9 @@ import (
 	"strings"
 )
 
-func HashSqliteSchema(ctx context.Context, schemaStr string) (string, error) {
+// HashMattnSqliteSchema
+// use if github.com/glebarez/go-sqlite
+func HashMattnSqliteSchema(ctx context.Context, schemaStr string) (string, error) {
 	dbdir := os.TempDir()
 	dbfile1 := filepath.Join(dbdir, langext.MustHexUUID()+".sqlite3")
 
@@ -39,6 +41,34 @@ func HashSqliteSchema(ctx context.Context, schemaStr string) (string, error) {
 	return HashSqliteDatabase(ctx, db)
 }
 
+// HashGoSqliteSchema
+// use if mattn/go-sqlite3
+func HashGoSqliteSchema(ctx context.Context, schemaStr string) (string, error) {
+	dbdir := os.TempDir()
+	dbfile1 := filepath.Join(dbdir, langext.MustHexUUID()+".sqlite3")
+
+	err := os.MkdirAll(dbdir, os.ModePerm)
+	if err != nil {
+		return "", err
+	}
+
+	url := fmt.Sprintf("file:%s?_pragma=journal_mode(%s)&_pragma=timeout(%d)&_pragma=foreign_keys(%s)&_pragma=busy_timeout(%d)", dbfile1, "DELETE", 1000, "true", 1000)
+
+	xdb, err := sqlx.Open("sqlite", url)
+	if err != nil {
+		return "", err
+	}
+
+	db := NewDB(xdb)
+
+	_, err = db.Exec(ctx, schemaStr, PP{})
+	if err != nil {
+		return "", err
+	}
+
+	return HashSqliteDatabase(ctx, db)
+}
+
 func HashSqliteDatabase(ctx context.Context, db Queryable) (string, error) {
 	ss, err := CreateSqliteDatabaseSchemaString(ctx, db)
 	if err != nil {