@@ -154,7 +154,7 @@ func (ls *LogStore) Create(id string, parentOpID int64, ttl time.Duration) (io.W
154154 defer ls .dbpool .Put (conn )
155155
156156 // potentially prune any expired logs
157- if err := sqlitex .ExecuteTransient (conn , "DELETE FROM logs WHERE expiration_ts_unix < ? AND expiration_ts_unix != 0" , & sqlitex.ExecOptions {
157+ if err := sqlitex .Execute (conn , "DELETE FROM logs WHERE expiration_ts_unix < ? AND expiration_ts_unix != 0" , & sqlitex.ExecOptions {
158158 Args : []any {time .Now ().Unix ()},
159159 }); err != nil {
160160 return nil , fmt .Errorf ("prune expired logs: %v" , err )
@@ -171,15 +171,13 @@ func (ls *LogStore) Create(id string, parentOpID int64, ttl time.Duration) (io.W
171171 return nil , fmt .Errorf ("create temp file: %v" , err )
172172 }
173173
174- expire_ts_unix := time . Unix ( 0 , 0 )
174+ var expire_ts_unix int64 = 0
175175 if ttl != 0 {
176- expire_ts_unix = time .Now ().Add (ttl )
176+ expire_ts_unix = time .Now ().Add (ttl ). Unix ()
177177 }
178178
179- // fmt.Printf("INSERT INTO logs (id, expiration_ts_unix, owner_opid, data_fname) VALUES (%v, %v, %v, %v)\n", id, expire_ts_unix.Unix(), parentOpID, fname)
180-
181- if err := sqlitex .ExecuteTransient (conn , "INSERT INTO logs (id, expiration_ts_unix, owner_opid, data_fname) VALUES (?, ?, ?, ?)" , & sqlitex.ExecOptions {
182- Args : []any {id , expire_ts_unix .Unix (), parentOpID , fname },
179+ if err := sqlitex .Execute (conn , "INSERT INTO logs (id, expiration_ts_unix, owner_opid, data_fname) VALUES (?, ?, ?, ?)" , & sqlitex.ExecOptions {
180+ Args : []any {id , expire_ts_unix , parentOpID , fname },
183181 }); err != nil {
184182 return nil , fmt .Errorf ("insert log: %v" , err )
185183 }
@@ -210,7 +208,7 @@ func (ls *LogStore) Open(id string) (io.ReadCloser, error) {
210208 var found bool
211209 var fname string
212210 var dataGz []byte
213- if err := sqlitex .ExecuteTransient (conn , "SELECT data_fname, data_gz FROM logs WHERE id = ?" , & sqlitex.ExecOptions {
211+ if err := sqlitex .Execute (conn , "SELECT data_fname, data_gz FROM logs WHERE id = ?" , & sqlitex.ExecOptions {
214212 Args : []any {id },
215213 ResultFunc : func (stmt * sqlite.Stmt ) error {
216214 found = true
@@ -267,7 +265,7 @@ func (ls *LogStore) Delete(id string) error {
267265 }
268266 defer ls .dbpool .Put (conn )
269267
270- if err := sqlitex .ExecuteTransient (conn , "DELETE FROM logs WHERE id = ?" , & sqlitex.ExecOptions {
268+ if err := sqlitex .Execute (conn , "DELETE FROM logs WHERE id = ?" , & sqlitex.ExecOptions {
271269 Args : []any {id },
272270 }); err != nil {
273271 return fmt .Errorf ("delete log: %v" , err )
@@ -286,7 +284,7 @@ func (ls *LogStore) DeleteWithParent(parentOpID int64) error {
286284 }
287285 defer ls .dbpool .Put (conn )
288286
289- if err := sqlitex .ExecuteTransient (conn , "DELETE FROM logs WHERE owner_opid = ?" , & sqlitex.ExecOptions {
287+ if err := sqlitex .Execute (conn , "DELETE FROM logs WHERE owner_opid = ?" , & sqlitex.ExecOptions {
290288 Args : []any {parentOpID },
291289 }); err != nil {
292290 return fmt .Errorf ("delete log: %v" , err )
@@ -302,7 +300,7 @@ func (ls *LogStore) SelectAll(f func(id string, parentID int64)) error {
302300 }
303301 defer ls .dbpool .Put (conn )
304302
305- return sqlitex .ExecuteTransient (conn , "SELECT id, owner_opid FROM logs ORDER BY owner_opid" , & sqlitex.ExecOptions {
303+ return sqlitex .Execute (conn , "SELECT id, owner_opid FROM logs ORDER BY owner_opid" , & sqlitex.ExecOptions {
306304 ResultFunc : func (stmt * sqlite.Stmt ) error {
307305 f (stmt .ColumnText (0 ), stmt .ColumnInt64 (1 ))
308306 return nil
@@ -364,7 +362,7 @@ func (ls *LogStore) finalizeLogFile(id string, fname string) error {
364362 }); e != nil {
365363 return fmt .Errorf ("update log: %v" , e )
366364 } else if conn .Changes () != 1 {
367- return fmt .Errorf ("expected 1 row to be updated, got %d" , conn .Changes ())
365+ return fmt .Errorf ("expected 1 row to be updated for %q , got %d" , id , conn .Changes ())
368366 }
369367
370368 return nil
0 commit comments