Skip to content

Commit

Permalink
closql-oref: Use cached value for closql-class slots
Browse files Browse the repository at this point in the history
We already cached the value but never used it.  For closql-table slots
we already cached and used the value, so any cache invalidation issues
this might result in, are in fact already in effect.
  • Loading branch information
tarsius committed Jan 25, 2024
1 parent 34ba553 commit dc8cacb
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions closql.el
Original file line number Diff line number Diff line change
Expand Up @@ -101,21 +101,23 @@
(db (closql--oref obj 'closql-database)))
(cond
(class
(aset obj c
(mapcar (lambda (row)
(closql--remake-instance class db row))
(emacsql db (vconcat
[:select * :from $i1
:where (= $i2 $s3)]
(vector
:order-by
(or (oref-default class closql-order-by)
[(asc $i4)])))
(oref-default class closql-table)
(oref-default class closql-foreign-key)
(closql--oref
obj (oref-default obj closql-primary-key))
(oref-default class closql-primary-key)))))
(if (eq value eieio--unbound)
(aset obj c
(mapcar
(lambda (row) (closql--remake-instance class db row))
(emacsql db (vconcat
[:select * :from $i1
:where (= $i2 $s3)]
(vector
:order-by
(or (oref-default class closql-order-by)
[(asc $i4)])))
(oref-default class closql-table)
(oref-default class closql-foreign-key)
(closql--oref
obj (oref-default obj closql-primary-key))
(oref-default class closql-primary-key))))
value))
(table
(if (eq value eieio--unbound)
(let ((columns (closql--table-columns db table)))
Expand Down

0 comments on commit dc8cacb

Please sign in to comment.