1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
|
;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
;;;; *************************************************************************
;;;; FILE IDENTIFICATION
;;;;
;;;; Name: oracle-objects.lisp
;;;;
;;;; This file is part of CLSQL.
;;;;
;;;; CLSQL users are granted the rights to distribute and use this software
;;;; as governed by the terms of the Lisp Lesser GNU Public License
;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
;;;; *************************************************************************
(in-package #:clsql-oracle)
(defmethod database-get-type-specifier (type args database (db-type (eql :oracle)))
(declare (ignore type args database))
(format nil "VARCHAR2(~D)" *default-string-length*))
(defmethod database-get-type-specifier ((type (eql 'integer)) args
database (db-type (eql :oracle)))
(declare (ignore database))
(if args
(format nil "NUMBER(~A,~A)"
(or (first args) 38) (or (second args) 0))
"INTEGER"))
(defmethod database-get-type-specifier ((type (eql 'bigint)) args
database (db-type (eql :oracle)))
(declare (ignore args database))
"CHAR(20)")
(defmethod database-get-type-specifier ((type (eql 'universal-time)) args
database (db-type (eql :oracle)))
(declare (ignore args database))
"CHAR(20)")
(defmethod database-get-type-specifier ((type (eql 'string)) args
database (db-type (eql :oracle)))
(declare (ignore database))
(if args
(format nil "CHAR(~A)" (car args))
(format nil "VARCHAR2(~D)" *default-string-length*)))
(defmethod database-get-type-specifier ((type (eql 'varchar)) args
database (db-type (eql :oracle)))
(declare (ignore database))
(if args
(format nil "VARCHAR2(~A)" (car args))
(format nil "VARCHAR2(~D)" *default-string-length*)))
(defmethod database-get-type-specifier ((type (eql 'float)) args
database (db-type (eql :oracle)))
(declare (ignore database))
(if args
(format nil "NUMBER(~A,~A)" (or (first args) 38) (or (second args) 38))
"DOUBLE PRECISION"))
(defmethod database-get-type-specifier ((type (eql 'long-float)) args
database (db-type (eql :oracle)))
(declare (ignore database))
(if args
(format nil "NUMBER(~A,~A)"
(or (first args) 38) (or (second args) 38))
"DOUBLE PRECISION"))
(defmethod database-get-type-specifier ((type (eql 'boolean)) args
database (db-type (eql :oracle)))
(declare (ignore args database))
"CHAR(1)")
(defmethod database-get-type-specifier ((type (eql 'generalized-boolean)) args
database (db-type (eql :oracle)))
(declare (ignore args database))
"CHAR(1)")
(defmethod read-sql-value (val type
database (db-type (eql :oracle)))
;;(format t "value is \"~A\" of type ~A~%" val (type-of val))
(declare (ignore type database))
(etypecase val
(string
(read-from-string val))
(symbol
nil)))
(defmethod read-sql-value (val (type (eql 'integer))
database (db-type (eql :oracle)))
(declare (ignore database))
val)
(defmethod read-sql-value (val (type (eql 'float))
database (db-type (eql :oracle)))
(declare (ignore database))
val)
(defmethod read-sql-value (val (type (eql 'boolean))
database (db-type (eql :oracle)))
(declare (ignore database))
(when (char-equal #\t (schar val 0))
t))
(defmethod read-sql-value (val (type (eql 'generalized-boolean))
database (db-type (eql :oracle)))
(declare (ignore database))
(when (char-equal #\t (schar val 0))
t))
(defmethod read-sql-value (val (type (eql 'bigint))
database (db-type (eql :oracle)))
(declare (ignore database))
(parse-integer val))
(defmethod read-sql-value (val (type (eql 'universal-time))
database (db-type (eql :oracle)))
(declare (ignore database))
(parse-integer val))
(defmethod database-get-type-specifier ((type (eql 'wall-time)) args
database (db-type (eql :oracle)))
(declare (ignore args database))
"DATE")
(defmethod database-get-type-specifier ((type (eql 'duration)) args
database (db-type (eql :oracle)))
(declare (ignore args database))
"NUMBER(38)")
|