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 (type args (database oracle-database))
21 (declare (ignore type args))
22 (concatenate 'string "VARCHAR2(" *oracle-default-varchar2-length* ")"))
24 (defmethod database-get-type-specifier ((type (eql 'integer)) args (database oracle-database))
26 (format nil "NUMBER(~A,~A)"
27 (or (first args) 38) (or (second args) 0))
30 (defmethod database-get-type-specifier ((type (eql 'bigint)) args (database oracle-database))
32 (format nil "NUMBER(~A,~A)"
33 (or (first args) 38) (or (second args) 0))
36 (defmethod database-get-type-specifier ((type (eql 'simple-base-string)) args (database oracle-database))
38 (format nil "VARCHAR2(~A)" (car args))
39 (concatenate 'string "VARCHAR2(" *oracle-default-varchar2-length* ")")))
41 (defmethod database-get-type-specifier ((type (eql 'simple-string)) args (database oracle-database))
43 (format nil "VARCHAR2(~A)" (car args))
44 (concatenate 'string "VARCHAR2(" *oracle-default-varchar2-length* ")")))
46 (defmethod database-get-type-specifier ((type (eql 'string)) args (database oracle-database))
48 (format nil "VARCHAR2(~A)" (car args))
49 (concatenate 'string "VARCHAR2(" *oracle-default-varchar2-length* ")")))
51 (defmethod database-get-type-specifier ((type (eql 'raw-string)) args (database oracle-database))
53 (format nil "VARCHAR2(~A)" (car args))
54 (concatenate 'string "VARCHAR2(" *oracle-default-varchar2-length* ")")))
56 (defmethod database-get-type-specifier ((type (eql 'float)) args (database oracle-database))
58 (format nil "NUMBER(~A,~A)" (or (first args) 38) (or (second args) 38))
61 (defmethod database-get-type-specifier ((type (eql 'long-float)) args (database oracle-database))
63 (format nil "NUMBER(~A,~A)"
64 (or (first args) 38) (or (second args) 38))
67 (defmethod database-get-type-specifier ((type (eql 'boolean)) args (database oracle-database))
68 (declare (ignore args))
71 (defmethod read-sql-value (val type (database oracle-database))
72 ;;(format t "value is \"~A\" of type ~A~%" val (type-of val))
73 (declare (ignore type))
76 (read-from-string val))
80 (defmethod read-sql-value
81 (val (type (eql 'integer)) (database oracle-database))
84 (defmethod read-sql-value (val (type (eql 'float)) (database oracle-database))
87 (defmethod read-sql-value (val (type (eql 'boolean)) (database oracle-database))
88 (when (char-equal #\t (schar val 0))
91 (defmethod database-get-type-specifier ((type (eql 'wall-time)) args (database oracle-database))
92 (declare (ignore args))
95 (defmethod database-get-type-specifier ((type (eql 'duration)) args (database oracle-database))
96 (declare (ignore args))