revDataFromQuery with variable list question

Terence Heaford t.heaford at btinternet.com
Sat Mar 15 12:16:33 EDT 2014


Thanks for pointing that out.

Just for clarity:

From  sqlite.org.

"Use single-quotes, not double-quotes, around string literals in SQL. This is what the SQL standard requires….
SQL uses double-quotes around identifiers (column or table names) that contains special characters or which are keywords. So double-quotes are a way of escaping identifier names. Hence, when you say column1="column1" that is equivalent to column1=column1 which is obviously always true."

All the best

Terry

On 15 Mar 2014, at 15:36, Peter Haworth <pete at lcsql.com> wrote:

> You should have double quotes around sql  entities like table and column
> names.  Single quotes will work in some but not all awkward
> implementations.
> 
> Pete
> lcSQL Software
> On Mar 15, 2014 12:50 AM, "Terence Heaford" <t.heaford at btinternet.com>
> wrote:
> 
>> I normally do my Sqlite queries like this, I think examples speak a
>> thousand words.:
>> 
>>   put merge("select date,type,description,amount,balance,category,recID
>> from '[[the uAcctName of this stack]]' order by date asc") into tSQL
>>   put revDataFromQuery(tab, return, the uDB of this stack, tSQL) into
>> tData
>> 
>> or
>> 
>>   put "select categoryName from 'categoryList' order by categoryName asc"
>> into tSQL
>>   put revDataFromQuery(tab, return, the uDB of stack  "myStack", tSQL)
>> into tCatNames
>> 
>> or
>> 
>>   put merge("SELECT date,type,description,amount,balance,category,recID
>> from '[[the uAcctName of this stack]]' where date >= [[tStartDate]] and
>> date <= [[tEndDate]] [[tCatStatement]] order by date asc") into tSQL
>>   put revDataFromQuery(tab, return, the uDB of this stack, tSQL) into
>> tData
>> 
>> or
>> 
>> put merge("type like '%[[tType]]%'") into tTypeQuery
>> 
>> put merge("[[tQuery]] [[tCatQuery]] [[tAmountQuery]] [[tDescQuery]]
>> [[tTypeQuery]] order by date asc") into tSQL
>> 
>> 
>> Is mTextContent a variable?
>> 
>> 
>> All the best
>> 
>> Terry
>> 
>> 
>> 
>> On 15 Mar 2014, at 05:44, Stephen MacLean <smaclean at madmansoft.com> wrote:
>> 
>>> Hi All,
>>> 
>>> I'm having a problem with this:
>>> 
>>> put "SELECT mFromGUID from messages WHERE (mTextContent LIKE '%:1%')"
>> into gMsgListQuery
>>> 
>>> put revDataFromQuery(,comma, gDatabaseID, gMsgListQUERY,"tFld") into
>> tSearchResult
>>> 
>>> puts nothing into tSearchResult and the result is empty.
>>> 
>>> Do I have escape something differently? Or just missing something?
>>> 
>>> TIA,
>>> 
>>> Steve MacLean
>>> 
>>> 
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list