keeping an update statement under 8k
Posted: Fri Jul 20, 2001 4:21 pm
We've got a form we're posting to a vortex page, with several values in it. One of them is a comma separated list of the form variables, such as:
FIELD1,FIELD2,FIELD3,FIELD4
etc.
In the vortex script, we're trying to generate an update statement. Something like this is what we're shooting for (in pseudovortex):
update mytable set FIELD1 = <getvar $FIELD1>, FIELD2 = <getvar $FIELD2>, FIELD3= <getvar $FIELD3> .......
OK, so the syntax there isn't great, but you get the idea.
In a nutshell, what we're doing is posting a string with the fields we're interested in, then looping through that string to build our SQL statement. We just can't seem to get it right, keep hitting problems like some of our fields have single quotes and other bad characters in them, and the update statement chokes on that.
We know it's possible to avoid those kinds of problems by using vortex variables in lieu of actual text values in the update statement, but we can't seem to get it right, and would love some sort of sample, ideally using the posted string/list of field names to help create the statement, then doing some sort of <getvar> magic to pull out the actual field values and put them into the update statement. Just keep in mind that some of those variables will have single quotes and other evil characters in them. Is what we're trying possible?
FIELD1,FIELD2,FIELD3,FIELD4
etc.
In the vortex script, we're trying to generate an update statement. Something like this is what we're shooting for (in pseudovortex):
update mytable set FIELD1 = <getvar $FIELD1>, FIELD2 = <getvar $FIELD2>, FIELD3= <getvar $FIELD3> .......
OK, so the syntax there isn't great, but you get the idea.
In a nutshell, what we're doing is posting a string with the fields we're interested in, then looping through that string to build our SQL statement. We just can't seem to get it right, keep hitting problems like some of our fields have single quotes and other bad characters in them, and the update statement chokes on that.
We know it's possible to avoid those kinds of problems by using vortex variables in lieu of actual text values in the update statement, but we can't seem to get it right, and would love some sort of sample, ideally using the posted string/list of field names to help create the statement, then doing some sort of <getvar> magic to pull out the actual field values and put them into the update statement. Just keep in mind that some of those variables will have single quotes and other evil characters in them. Is what we're trying possible?