branch: elpa/emacsql commit b33073257e0ad0cce8c026d24d9705e3b35f6e6d Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
Use common base class for all SQLite connection classes --- emacsql-sqlite-builtin.el | 11 +---------- emacsql-sqlite-common.el | 16 ++++++++++++++++ emacsql-sqlite-module.el | 11 +---------- emacsql-sqlite.el | 12 ++---------- 4 files changed, 20 insertions(+), 30 deletions(-) diff --git a/emacsql-sqlite-builtin.el b/emacsql-sqlite-builtin.el index 59447011fc..69fe989af0 100644 --- a/emacsql-sqlite-builtin.el +++ b/emacsql-sqlite-builtin.el @@ -26,16 +26,7 @@ (emacsql-register-reserved emacsql-sqlite-reserved) -(defclass emacsql-sqlite-builtin-connection (emacsql-connection) - ((file :initarg :file - :type (or null string) - :documentation "Database file name.") - (types :allocation :class - :reader emacsql-types - :initform '((integer "INTEGER") - (float "REAL") - (object "TEXT") - (nil nil)))) +(defclass emacsql-sqlite-builtin-connection (emacsql--sqlite-base) () "A connection to a SQLite database using builtin support.") (cl-defmethod initialize-instance :after diff --git a/emacsql-sqlite-common.el b/emacsql-sqlite-common.el index cf08344d7d..fd1446e6ea 100644 --- a/emacsql-sqlite-common.el +++ b/emacsql-sqlite-common.el @@ -13,6 +13,22 @@ ;;; Code: +(require 'emacsql) + +;;; Base class + +(defclass emacsql--sqlite-base (emacsql-connection) + ((file :initarg :file + :type (or null string) + :documentation "Database file name.") + (types :allocation :class + :reader emacsql-types + :initform '((integer "INTEGER") + (float "REAL") + (object "TEXT") + (nil nil)))) + :abstract t) + ;;; Constants (defconst emacsql-sqlite-reserved diff --git a/emacsql-sqlite-module.el b/emacsql-sqlite-module.el index 000b837897..ae72f284ad 100644 --- a/emacsql-sqlite-module.el +++ b/emacsql-sqlite-module.el @@ -28,16 +28,7 @@ (emacsql-register-reserved emacsql-sqlite-reserved) -(defclass emacsql-sqlite-module-connection (emacsql-connection) - ((file :initarg :file - :type (or null string) - :documentation "Database file name.") - (types :allocation :class - :reader emacsql-types - :initform '((integer "INTEGER") - (float "REAL") - (object "TEXT") - (nil nil)))) +(defclass emacsql-sqlite-module-connection (emacsql--sqlite-base) () "A connection to a SQLite database using a module.") (cl-defmethod initialize-instance :after diff --git a/emacsql-sqlite.el b/emacsql-sqlite.el index 3d0045a1b0..8f00da8796 100644 --- a/emacsql-sqlite.el +++ b/emacsql-sqlite.el @@ -55,16 +55,8 @@ Each is queried using `executable-find', so full paths are allowed. Only the first compiler which is successfully found will used.") -(defclass emacsql-sqlite-connection (emacsql-connection emacsql-protocol-mixin) - ((file :initarg :file - :type (or null string) - :documentation "Database file name.") - (types :allocation :class - :reader emacsql-types - :initform '((integer "INTEGER") - (float "REAL") - (object "TEXT") - (nil nil)))) +(defclass emacsql-sqlite-connection + (emacsql--sqlite-base emacsql-protocol-mixin) () "A connection to a SQLite database.") (cl-defmethod initialize-instance :after