Skip to content
Browse files

renamed <dbd-query> -> <dbi-query>.

  • Loading branch information...
1 parent 22b063e commit 145cb1b3b63d55489a074114e83dd7f2f913b502 @fukamachi committed Jan 30, 2012
Showing with 19 additions and 19 deletions.
  1. +2 −2 README.markdown
  2. +1 −1 src/dbd/mysql.lisp
  3. +1 −1 src/dbd/postgres.lisp
  4. +3 −3 src/dbd/sqlite3.lisp
  5. +7 −7 src/driver.lisp
  6. +4 −4 src/test.lisp
  7. +1 −1 t/driver.lisp
View
4 README.markdown
@@ -40,7 +40,7 @@ This library will be available on Quicklisp when ready to use.
* connect [driver-name &amp; params] =&gt; &lt;dbi-connection&gt;
* disconnect [&lt;dbi-connection&gt;] =&gt; T or NIL
-* prepare [conn sql] =&gt; &lt;dbd-query&gt;
+* prepare [conn sql] =&gt; &lt;dbi-query&gt;
* execute [query &amp; params] =&gt; something
* fetch [result] =&gt; a row data as plist
* do-sql [conn sql &amp; params]
@@ -57,7 +57,7 @@ This library will be available on Quicklisp when ready to use.
* &lt;dbi-connection&gt;
* make-connection [driver params]
* disconnect [&lt;dbi-connection&gt;] =&gt; T or NIL
-* prepare [conn sql] =&gt; &lt;dbd-query&gt;
+* prepare [conn sql] =&gt; &lt;dbi-query&gt;
* fetch-using-connection [conn result] =&gt; a row data as plist
* do-sql [conn sql &amp; params]
* execute-using-connection =&gt; something
View
2 src/dbd/mysql.lisp
@@ -32,7 +32,7 @@
:client-flag client-flag)))
@export
-(defclass <dbd-mysql-query> (<dbd-query>)
+(defclass <dbd-mysql-query> (<dbi-query>)
((%result :initform nil)))
(defmethod prepare ((conn <dbd-mysql-connection>) (sql string) &key)
View
2 src/dbd/postgres.lisp
@@ -24,7 +24,7 @@
:handle (open-database database-name username password host port use-ssl)))
@export
-(defclass <dbd-postgres-query> (<dbd-query>)
+(defclass <dbd-postgres-query> (<dbi-query>)
((name :initarg :name)
(%result :initform nil)))
View
6 src/dbd/sqlite3.lisp
@@ -26,11 +26,11 @@
:handle (connect database-name)))
(defmethod prepare ((conn <dbd-sqlite3-connection>) (sql string) &key)
- (make-instance '<dbd-query>
+ (make-instance '<dbi-query>
:connection conn
:prepared (prepare-statement (connection-handle conn) sql)))
-(defmethod execute-using-connection ((conn <dbd-sqlite3-connection>) (query <dbd-query>) params)
+(defmethod execute-using-connection ((conn <dbd-sqlite3-connection>) (query <dbi-query>) params)
(let ((count 0))
(dolist (param params)
(bind-parameter (query-prepared query) (incf count) param)))
@@ -39,7 +39,7 @@
(defmethod do-sql ((conn <dbd-sqlite3-connection>) (sql string) &rest params)
(apply #'execute-non-query (connection-handle conn) sql params))
-(defmethod fetch-using-connection ((conn <dbd-sqlite3-connection>) (query <dbd-query>))
+(defmethod fetch-using-connection ((conn <dbd-sqlite3-connection>) (query <dbi-query>))
@ignore conn
(let ((prepared (query-prepared query)))
(when (handler-case (step-statement prepared)
View
14 src/driver.lisp
@@ -65,7 +65,7 @@ Driver should be named like '<DBD-SOMETHING>' for a database 'something'."
(c2mop:class-direct-subclasses (find-class '<dbi-driver>)))
@export
-(defclass <dbd-query> ()
+(defclass <dbi-query> ()
((connection :type <dbi-connection>
:initarg :connection
:initform nil
@@ -76,28 +76,28 @@ Driver should be named like '<DBD-SOMETHING>' for a database 'something'."
(:documentation "Class that represents a prepared DB query."))
@export
-(defmethod prepare ((conn <dbi-connection>) (sql string) &key (query-class '<dbd-query>))
- "Preparing executing SQL statement and returns a instance of `<dbd-query>`.
+(defmethod prepare ((conn <dbi-connection>) (sql string) &key (query-class '<dbi-query>))
+ "Preparing executing SQL statement and returns a instance of `<dbi-query>`.
This method may be overrided by subclasses."
(make-instance query-class
:connection conn
:prepared (prepare-sql conn sql)))
@export
-(defmethod execute ((query <dbd-query>) &rest params)
+(defmethod execute ((query <dbi-query>) &rest params)
"Execute `query` with `params` and return the results."
(execute-using-connection
(query-connection query)
query
params))
@export
-(defmethod fetch ((query <dbd-query>))
+(defmethod fetch ((query <dbi-query>))
"Fetch the first row from `query` which is returned by `execute`."
(fetch-using-connection (query-connection query) query))
@export
-(defmethod fetch-using-connection ((conn <dbi-connection>) (query <dbd-query>))
+(defmethod fetch-using-connection ((conn <dbi-connection>) (query <dbi-query>))
@ignore driver
(error '<dbi-unimplemented-error>
:method-name 'fetch-using-connection))
@@ -110,7 +110,7 @@ This method may be overrided by subclasses."
nil)
@export
-(defmethod execute-using-connection ((conn <dbi-connection>) (query <dbd-query>) params)
+(defmethod execute-using-connection ((conn <dbi-connection>) (query <dbi-query>) params)
"Execute `query` in `conn`.
This method must be implemented in each drivers."
@ignore (conn query params)
View
8 src/test.lisp
@@ -37,9 +37,9 @@
(deftest |prepare, execute & fetch|
(let (query result)
(setf query (prepare *db* "SELECT * FROM person"))
- (is-type query '<dbd-query>)
+ (is-type query '<dbi-query>)
(setf result (execute query))
- (is-type result '<dbd-query>)
+ (is-type result '<dbi-query>)
(let ((result (fetch result)))
(is-type result '(non-nil property-list))
(is (getf result :|name|) "fukamachi"))
@@ -51,9 +51,9 @@
(deftest |place holder|
(let (query result)
(setf query (prepare *db* "SELECT * FROM person WHERE name = ?"))
- (is-type query '<dbd-query>)
+ (is-type query '<dbi-query>)
(setf result (execute query "matsuyama"))
- (is-type result '<dbd-query>)
+ (is-type result '<dbi-query>)
(is-type (fetch result) '(non-nil property-list))
(is (fetch result) nil)))
View
2 t/driver.lisp
@@ -37,7 +37,7 @@
(prepare *connection* "SELECT * FROM kyoto WHERE type = ?"))
(is-type *query*
- '<dbd-query>
+ '<dbi-query>
"prepare")
(is (funcall (slot-value *query* 'dbi.driver::prepared) "cafe")

0 comments on commit 145cb1b

Please sign in to comment.
Something went wrong with that request. Please try again.