From 4788b3ac25bd649a7e034f4ee130183f37294acd Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Thu, 8 Jul 2004 16:32:52 +0000 Subject: [PATCH] r9741: 8 Jul 2004 Kevin Rosenberg * sql/fdml.lisp: Apply patch from Kim Minh Kaplan to change escaping of single quotes. Mild optimizations for escaped string output. * TODO: Add need to test single quote escaping --- ChangeLog | 6 ++++++ TODO | 1 + sql/fdml.lisp | 11 ++++++----- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index fc2e0b7..e6db1dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +8 Jul 2004 Kevin Rosenberg + * sql/fdml.lisp: Apply patch from Kim Minh Kaplan + to change escaping of single quotes. Mild optimizations + for escaped string output. + * TODO: Add need to test single quote escaping + 7 Jul 2004 Kevin Rosenberg * doc/ref-ooddl.xml, doc-ref-oodml.xml: documentation additions * sql/ooddl.lisp: Added SMALLINT type diff --git a/TODO b/TODO index 7c9ebeb..a3c5a6c 100644 --- a/TODO +++ b/TODO @@ -12,6 +12,7 @@ TESTS TO ADD * symbol slot * generalized-boolean slot * column and table constraints in CREATE-TABLE and DEF-VIEW-CLASS. +* escaping of single quotes OPTIMIZATIONS diff --git a/sql/fdml.lisp b/sql/fdml.lisp index ee9a37d..470ad37 100644 --- a/sql/fdml.lisp +++ b/sql/fdml.lisp @@ -200,7 +200,7 @@ are nil and AV-PAIRS is an alist of (attribute value) pairs." (type (simple-array * (*)) str)) (let ((len (length str))) (declare (type fixnum len)) - (cond ((= len 0) + (cond ((zerop len) +empty-string+) ((and (null (position #\' str)) (null (position #\\ str))) @@ -210,13 +210,14 @@ are nil and AV-PAIRS is an alist of (attribute value) pairs." (do* ((i 0 (incf i)) (j 1 (incf j))) ((= i len) (subseq buf 0 (1+ j))) - (declare (type integer i j)) + (declare (type fixnum i j)) (let ((char (aref str i))) - (cond ((eql char #\') - (setf (aref buf j) #\\) + (declare (character char)) + (cond ((char= char #\') + (setf (aref buf j) #\') (incf j) (setf (aref buf j) #\')) - ((eql char #\\) + ((char= char #\\) (setf (aref buf j) #\\) (incf j) (setf (aref buf j) #\\)) -- 2.34.1