Anomoly when storing empty values into SQLite integer fields

Pete pete at mollysrevenge.com
Wed Feb 22 01:20:00 EST 2012


Hi Mark,
I think this may not be difficult.  Turns out you can use an array with
numbered keys instead of a list of variables with revExecuteSQL, so here's
some code ( completely untested)

put 1 into x
put "UPDATE test SET " into mySQL
repeat for each item myField in "One,Two,Three"
   if field myField is not empty then
      put myField & "=:" & x & comma after mySQL
      put field myField into myArray[x]
      add 1 to x
   end if
end repeat
put space into char -1 of mySQL
put "where ID=" & tID after mySQL
revExecuteSQL gConnectID, mySQL, myArray

Shouldn't be too hard to generalise it as a command/function if necessary.

But then the easiest thing might be to just use text instead.

I plan to enter this as bug tomorrow, as well as the incorrect handling of
the NULL keyword.

Pete

On Tue, Feb 21, 2012 at 7:19 PM, Mark Smith <Mark_Smith at cpe.umanitoba.ca>wrote:

>
> Peter Haworth-2 wrote
> >
> > Yes, it causes a headache, you're right.  You would have to  build the
> > UPDATE command in a variable by examining each field for empty and adding
> > it to the variable list if not empty.  Don't have time to give some
> > example
> > code right now, but will try to do something tomorrow.
> > Pete
> >
>
> Thats ok, thats enough of a hint... I can work something up from there. If
> fld"one" is not empty then
>    put "some string" after "the string I'm trying to build"
> should do it.
>
> Thanks
>
> -- M
>
> --
> View this message in context:
> http://runtime-revolution.278305.n4.nabble.com/Anomoly-when-storing-empty-values-into-SQLite-integer-fields-tp4408942p4409145.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> 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
>
>


-- 
Pete
Molly's Revenge <http://www.mollysrevenge.com>



More information about the use-livecode mailing list