mysql: troubles with insert
Trevor DeVore
lists at mangomultimedia.com
Fri Jul 20 09:27:46 EDT 2007
On Jul 20, 2007, at 4:18 AM, Henk van der Velden wrote:
> I think something is wrong in the way Rev creates a query out of my
> array.
> If I force Rev to put the right value in the query by doing this:
> put "INSERT INTO g2_Entity() VALUES('"&vars[1]&"',:
> 2,:3,:4,:2,:3,:5,:4)" into tsql
> the record is inserted with the correct id.
> But the standard way:
> put "INSERT INTO g2_Entity() VALUES(:1,:2,:3,:4,:2,:3,:5,:4)"
> into tsql
> inserts it with the wrong id.
>
> I have double checked the values of my array vars[] - it is OK.
>
> I was wondering if this might have something to do with the way Rev
> handles arrays. Rev 'does' only associative arrays, not numeric
> arrays, isn' t it? I was a bit surprised to find out that I had to
> use numeric arrays in order to build queries.
Hi Henk,
I've seen a bug in the MySQL driver that is probably the same one you
are seeing. I don't know the exact recipe but I came across it when I
was:
1) Using binding with RevDB calls.
2) Inserting values into a table with only integer columns.
I think what happened in my case is that one of the binding variables
(:1 for example) would get the value of another binding variable. If
I remember correctly (and this was a long time ago) I was able to fix
this by either altering my table structure so the table included a
string value or not using binding.
--
Trevor DeVore
Blue Mango Learning Systems
www.bluemangolearning.com - www.screensteps.com
trevor at bluemangolearning.com
More information about the use-livecode
mailing list