Re: array and revExecuteSQL

2019-05-16 Thread axwald via use-livecode
Hi.

Paul Dupuis via use-livecode wrote
> I believe you need to surround the placeholder with single quotes.

Doesn't work, my LC doesn't do the replacement:
> UPDATE `t_test` SET `Text` = ':11' WHERE `Nummer` = ':22';
and
> UPDATE `t_test` SET `Text` = :'11' WHERE `Nummer` = :'22';
are sent to the db w/o changes.

Interesting:
> put "cText" into myArr[8]
> put "99" into myArr[9]
> put "UPDATE `t_test` SET `Text` = :8 WHERE `Nummer` = :9;" into StrSQL 
doesn't replace, whereas:
> put "cText" into myArr[8]
> put "99" into myArr[9]
> put "UPDATE `t_test` SET `Text` = :1 WHERE `Nummer` = :2;" into StrSQL 
does - according to the order of the numbers ;-)
So the placeholders in the SQL string MUST BE :1 to :9, and MUST BE used in
ascending order. :0 isn't recognized.


Paul Dupuis via use-livecode wrote
> Also you can lose the semicolon as LC will only execute one statement at a
> time. You cannot string statements. 

Well, it doesn't hurt either, and I'm so used to it :)

Have fun!



-
• Livecode programming until the cat hits the fan •
--
Sent from: 
http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: array and revExecuteSQL

2019-05-15 Thread Bob Sneidar via use-livecode
I believe you need to surround the placeholder with single quotes. 

>> put "UPDATE `t_test` SET `Text` = ':11' WHERE `Nummer` = ':22';" into StrSQL

Also you can lose the semicolon as LC will only execute one statement at a 
time. You cannot string statements. 

Bob S


> On May 15, 2019, at 06:46 , axwald via use-livecode 
>  wrote:
> 
> Hi,
> the notation for revExecuteSQL you mention only works with 1-digit numbers
> (in my LC 6.7.10).
> Named arrays and 2- or more digit entries don't work - LC doesn't translate
> 'em. You can easily check this with your favorite network sniffer:
> 
>> put "bText" into myArr[11]
>> put "99" into myArr[22]
>> put "UPDATE `t_test` SET `Text` = :11 WHERE `Nummer` = :22;" into StrSQL
> sends this to the database:
>> UPDATE `t_test` SET `Text` = :11 WHERE `Nummer` = :22;
> and this fails, for sure.
> 
> Correctly used:
>> put "bText" into myArr[1]
>> put "99" into myArr[2]
>> put "UPDATE `t_test` SET `Text` = :1 WHERE `Nummer` = :2;" into StrSQL
> sends this to the database:
>> UPDATE `t_test` SET `Text` = "bText" WHERE `Nummer` = "99";
> 
> So the error is in LC, dunno if the newer versions do better. Or the
> limitation just isn't mentioned in the dictionary.
> And since LC obviously just does a simple & limited replace, you could use
> merge() as well.
> 
> Have fun!
> 
> 
> 
> -
> • Livecode programming until the cat hits the fan •
> --
> Sent from: 
> http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html
> 
> ___
> use-livecode mailing list
> use-livecode@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: array and revExecuteSQL

2019-05-15 Thread axwald via use-livecode
Hi,
the notation for revExecuteSQL you mention only works with 1-digit numbers
(in my LC 6.7.10).
Named arrays and 2- or more digit entries don't work - LC doesn't translate
'em. You can easily check this with your favorite network sniffer:

> put "bText" into myArr[11]
> put "99" into myArr[22]
> put "UPDATE `t_test` SET `Text` = :11 WHERE `Nummer` = :22;" into StrSQL
sends this to the database:
> UPDATE `t_test` SET `Text` = :11 WHERE `Nummer` = :22;
and this fails, for sure.

Correctly used:
> put "bText" into myArr[1]
> put "99" into myArr[2]
> put "UPDATE `t_test` SET `Text` = :1 WHERE `Nummer` = :2;" into StrSQL
sends this to the database:
> UPDATE `t_test` SET `Text` = "bText" WHERE `Nummer` = "99";

So the error is in LC, dunno if the newer versions do better. Or the
limitation just isn't mentioned in the dictionary.
And since LC obviously just does a simple & limited replace, you could use
merge() as well.

Have fun!



-
• Livecode programming until the cat hits the fan •
--
Sent from: 
http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: array and revExecuteSQL

2019-05-13 Thread Bob Sneidar via use-livecode
No because the array form uses a substitution method for SQL statements like 
"custom = ':1'" the :1 being replaced by the contents of tArray [1] when the 
SQL statement is assembled. I don't think you can use ":lattitude" in the 
select statement, but that would be an SQL limitation not an LC one. 

Bob S


> On May 8, 2019, at 02:47 , Ludovic THEBAULT via use-livecode 
>  wrote:
> 
> hello
> 
> when you use array with revExecuteSQL like :
> 
> revExecuteSQL, dbID, tSQL, "tarray"
> 
> can we use array wth keys as text and not number :
> tarray["latitude"] vs tarray[1]
> 
> i’ve some bug with first syntax.
> 
> Thanks for your light !

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

array and revExecuteSQL

2019-05-08 Thread Ludovic THEBAULT via use-livecode
hello

when you use array with revExecuteSQL like :

revExecuteSQL, dbID, tSQL, "tarray"

can we use array wth keys as text and not number :
tarray["latitude"] vs tarray[1]

i’ve some bug with first syntax.

Thanks for your light !
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode