From a9435364ee1bb47ae61f2cd4738867a09dc4ba21 Mon Sep 17 00:00:00 2001 From: glebarez Date: Sat, 1 Oct 2022 00:53:46 +0700 Subject: [PATCH] use ParseInLocation with UTC zone --- sqlite.go | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/sqlite.go b/sqlite.go index 109a11f..d0efc3c 100644 --- a/sqlite.go +++ b/sqlite.go @@ -314,7 +314,7 @@ func (c *conn) parseTime(s string) (interface{}, bool) { ts := strings.TrimSuffix(s, "Z") for _, f := range parseTimeFormats { - t, err := time.Parse(f, ts) + t, err := time.ParseInLocation(f, ts, time.UTC) if err == nil { return t, true } @@ -482,7 +482,6 @@ func (s *stmt) Close() (err error) { // Exec executes a query that doesn't return rows, such as an INSERT or UPDATE. // -// // Deprecated: Drivers should implement StmtExecContext instead (or // additionally). func (s *stmt) Exec(args []driver.Value) (driver.Result, error) { //TODO StmtExecContext @@ -1218,11 +1217,13 @@ func (c *conn) finalize(pstmt uintptr) error { } // int sqlite3_prepare_v2( -// sqlite3 *db, /* Database handle */ -// const char *zSql, /* SQL statement, UTF-8 encoded */ -// int nByte, /* Maximum length of zSql in bytes. */ -// sqlite3_stmt **ppStmt, /* OUT: Statement handle */ -// const char **pzTail /* OUT: Pointer to unused portion of zSql */ +// +// sqlite3 *db, /* Database handle */ +// const char *zSql, /* SQL statement, UTF-8 encoded */ +// int nByte, /* Maximum length of zSql in bytes. */ +// sqlite3_stmt **ppStmt, /* OUT: Statement handle */ +// const char **pzTail /* OUT: Pointer to unused portion of zSql */ +// // ); func (c *conn) prepareV2(zSQL *uintptr) (pstmt uintptr, err error) { var ppstmt, pptail uintptr @@ -1277,10 +1278,12 @@ func (c *conn) extendedResultCodes(on bool) error { } // int sqlite3_open_v2( -// const char *filename, /* Database filename (UTF-8) */ -// sqlite3 **ppDb, /* OUT: SQLite db handle */ -// int flags, /* Flags */ -// const char *zVfs /* Name of VFS module to use */ +// +// const char *filename, /* Database filename (UTF-8) */ +// sqlite3 **ppDb, /* OUT: SQLite db handle */ +// int flags, /* Flags */ +// const char *zVfs /* Name of VFS module to use */ +// // ); func (c *conn) openV2(name string, flags int32) (uintptr, error) { var p, s uintptr