cleaning up patches, and fixing missing pkey bugs in sqlite3
[clsql.git] / db-sqlite3 / sqlite3-methods.lisp
1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2
3 (in-package #:clsql-sys)
4
5
6 (defmethod database-pkey-constraint ((class standard-db-class)
7                                      (database clsql-sqlite3:sqlite3-database))
8   (let* ((keys (keyslots-for-class class))
9          (cons (when (= 1 (length keys))
10                  (view-class-slot-db-constraints (first keys)))))
11     ;; This method generates primary key constraints part of the table
12     ;; definition. For Sqlite autoincrement primary keys to work properly
13     ;; this part of the table definition must be left out (IFF autoincrement) .
14     (when (or (null cons) ;; didnt have constraints to check
15               ;; didnt have auto-increment
16               (null (intersection
17                      +auto-increment-names+
18                      (listify cons))))
19       (call-next-method))))
20