Newbie having SQL select problems with array in 2.5.8 - resolved
Sumner, Walt
WSUMNER at im.wustl.edu
Sat Feb 2 09:59:03 CST 2008
Hi,
The spaces are OK here because the double ampersands insert a space between
the concatenated strings:
put "SELECT * FROM" && pName && "WHERE" && item 1 of pFieldList \
^^^^^^^^^^^^^^^^^^
However, there was no space before the colon (":1") in this statement:
>Without the extra line, tSQL looks something like this:
>
>SELECT * FROM ICD_Term WHERE Code=:1
("Code=:1" came from pFieldList)
Adding a space between "=" and ":" resolves the problem.
Thanks,
Walt
Message: 6
Date: Sat, 02 Feb 2008 09:41:33 +0200
From: Ruslan Zasukhin <sunshine at public.kherson.ua>
Subject: Re: Newbie having SQL select problems with array in 2.5.8
To: "valentina at lists.macserve.net" <valentina at lists.macserve.net>
Message-ID: <C3C9EB4D.8C991%sunshine at public.kherson.ua>
Content-Type: text/plain; charset="US-ASCII"
On 1/2/08 11:26 PM, "Walton Sumner" <wsumner at im.wustl.edu> wrote:
Hi Walton,
> Here is a snippet of code that works only when the extra line is present:
>
> function updateTable pName,pFieldList,pArray
> local tKey, tCursor, tCount, tSQL, tItem, tValues, i, tResult
> if pArray[1] = "" then return "Error: empty key value in array"
> put "SELECT * FROM" && pName && "WHERE" && item 1 of pFieldList \
^^^^^^^^^^^^^^^^^^
It seems to me this will produce SQL string as
SELECT * FROMmytableWHERE
You need take care about spaces
> put "SELECT * FROM " && pName && " WHERE" && item 1 of pFieldList \
--
> --THIS IS THE EXTRA LINE:
> replace ":1" with "'" & pArray[1] & "'" in tSQL
I do not see
where in tSQL was specified :1 ?
Actually can be the same effect of spaces
put "SELECT * FROM " && pName && " WHERE " && item 1 of pFieldList \
^^^^^^^^^^^^^^^^^^^^^^^^^
More information about the Valentina
mailing list