1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
5 ;;;; Name: oracle-objects.lisp
9 ;;;; This file is part of CLSQL.
11 ;;;; CLSQL users are granted the rights to distribute and use this software
12 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
13 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
14 ;;;; *************************************************************************
16 (in-package #:clsql-oracle)
18 (defparameter *oracle-default-varchar2-length* "512")
20 (defmethod database-get-type-specifier
21 (type args (database oracle-database))
22 (declare (ignore type args))
23 (concatenate 'string "VARCHAR2(" *oracle-default-varchar2-length* ")"))
25 (defmethod database-get-type-specifier
26 ((type (eql 'integer)) args (database oracle-database))
28 (format nil "NUMBER(~A,~A)"
29 (or (first args) 38) (or (second args) 0))
32 (defmethod database-get-type-specifier
33 ((type (eql 'simple-base-string)) args (database oracle-database))
35 (format nil "VARCHAR2(~A)" (car args))
36 (concatenate 'string "VARCHAR2(" *oracle-default-varchar2-length* ")")))
38 (defmethod database-get-type-specifier
39 ((type (eql 'simple-string)) args (database oracle-database))
41 (format nil "VARCHAR2(~A)" (car args))
42 (concatenate 'string "VARCHAR2(" *oracle-default-varchar2-length* ")")))
44 (defmethod database-get-type-specifier
45 ((type (eql 'string)) args (database oracle-database))
47 (format nil "VARCHAR2(~A)" (car args))
48 (concatenate 'string "VARCHAR2(" *oracle-default-varchar2-length* ")"))
51 (defmethod database-get-type-specifier
52 ((type (eql 'raw-string)) args (database oracle-database))
54 (format nil "VARCHAR2(~A)" (car args))
55 (concatenate 'string "VARCHAR2(" *oracle-default-varchar2-length* ")"))
58 (defmethod database-get-type-specifier
59 ((type (eql 'float)) args (database oracle-database))
61 (format nil "NUMBER(~A,~A)"
62 (or (first args) 38) (or (second args) 38))
65 (defmethod database-get-type-specifier
66 ((type (eql 'long-float)) args (database oracle-database))
68 (format nil "NUMBER(~A,~A)"
69 (or (first args) 38) (or (second args) 38))
72 (defmethod read-sql-value (val type (database oracle-database))
73 ;;(format t "value is \"~A\" of type ~A~%" val (type-of val))
74 (declare (ignore type))
77 (read-from-string val))
81 (defmethod read-sql-value (val (type (eql 'string)) database)
82 (declare (ignore database))
85 (defmethod read-sql-value
86 (val (type (eql 'integer)) (database oracle-database))
89 (defmethod read-sql-value (val (type (eql 'float)) (database oracle-database))
92 ;;; LOCAL-TIME stuff that needs to go into hooks
94 (defmethod clsql::database-get-type-specifier
95 ((type (eql 'local-time::local-time)) args (database oracle-database))
96 (declare (ignore args))
100 (defmethod clsql::database-get-type-specifier
101 ((type (eql 'local-time::duration))
103 (database oracle-database))
104 (declare (ignore args))