(defun convert-to-clsql-warning (database condition)
(ecase *backend-warning-behavior*
(:warn
- (warn 'clsql-database-warning :database database
+ (warn 'sql-database-warning :database database
:message (postgresql-condition-message condition)))
(:error
- (error 'clsql-sql-error :database database
+ (error 'sql-database-error :database database
:message (format nil "Warning upgraded to error: ~A"
(postgresql-condition-message condition))))
((:ignore nil)
)))
(defun convert-to-clsql-error (database expression condition)
- (error 'clsql-sql-error :database database
+ (error 'sql-database-data-error
+ :database database
:expression expression
- :errno (type-of condition)
- :error (postgresql-condition-message condition)))
+ :error-id (type-of condition)
+ :message (postgresql-condition-message condition)))
(defmacro with-postgresql-handlers
((database &optional expression)
:password password))
(postgresql-error (c)
;; Connect failed
- (error 'clsql-connect-error
+ (error 'sql-connection-error
:database-type database-type
:connection-spec connection-spec
- :errno (type-of c)
- :error (postgresql-condition-message c)))
+ :error-id (type-of c)
+ :message (postgresql-condition-message c)))
(:no-error (connection)
;; Success, make instance
(make-instance 'postgresql-socket-database
(wait-for-query-results connection)
(unless (eq status :cursor)
(close-postgresql-connection connection)
- (error 'clsql-sql-error
+ (error 'sql-database-data-error
:database database
:expression expression
- :errno 'missing-result
- :error "Didn't receive result cursor for query."))
+ :error-id "missing-result"
+ :message "Didn't receive result cursor for query."))
(setq result-types (canonicalize-types result-types cursor))
(values
(loop for row = (read-cursor-row cursor result-types)
finally
(unless (null (wait-for-query-results connection))
(close-postgresql-connection connection)
- (error 'clsql-sql-error
+ (error 'sql-database-data-error
:database database
:expression expression
- :errno 'multiple-results
- :error "Received multiple results for query.")))
+ :error-id "multiple-results"
+ :message "Received multiple results for query.")))
(when field-names
(mapcar #'car (postgresql-cursor-fields cursor))))))))
((eq status :completed)
(unless (null (wait-for-query-results connection))
(close-postgresql-connection connection)
- (error 'clsql-sql-error
+ (error 'sql-database-data-error
:database database
:expression expression
- :errno 'multiple-results
- :error "Received multiple results for command."))
+ :error-id "multiple-results"
+ :message "Received multiple results for command."))
result)
(t
(close-postgresql-connection connection)
- (error 'clsql-sql-error
+ (error 'sql-database-data-error
:database database
:expression expression
- :errno 'missing-result
- :error "Didn't receive completion for command.")))))))
+ :errno "missing-result"
+ :message "Didn't receive completion for command.")))))))
(defstruct postgresql-socket-result-set
(done nil)
(wait-for-query-results connection)
(unless (eq status :cursor)
(close-postgresql-connection connection)
- (error 'clsql-sql-error
+ (error 'sql-database-data-error
:database database
:expression expression
- :errno 'missing-result
- :error "Didn't receive result cursor for query."))
+ :error-id "missing-result"
+ :message "Didn't receive result cursor for query."))
(values (make-postgresql-socket-result-set
:done nil
:cursor cursor
owner-clause)
database nil nil))))
(if result
- (reverse
- (remove-if #'(lambda (it) (member it '("cmin"
- "cmax"
- "xmax"
- "xmin"
- "oid"
- "ctid"
- ;; kmr -- added tableoid
- "tableoid") :test #'equal))
- result)))))
+ (remove-if #'(lambda (it) (member it '("cmin"
+ "cmax"
+ "xmax"
+ "xmin"
+ "oid"
+ "ctid"
+ ;; kmr -- added tableoid
+ "tableoid") :test #'equal))
+ result))))
(defmethod database-attribute-type (attribute (table string)
(database postgresql-socket-database)