runPrepUpdate questions

I have couple question about the runPrepUpdate:

  1. Does the query need to be in order? Like:
    system.db.runPrepUpdate("INSERT INTO sometable (who, what, when, where) VALUES(?,?,?,?)", [who, what, when, where])

OR can the items in the ( ) be in different order than the items in the ? Like:
system.db.runPrepUpdate("INSERT INTO sometable (who, what, when, where) VALUES(?,?,?,?)", [who, what, where, when])

  1. Do the items in the need to match the column names in the table your writing to?

Yes, they need to be in order, because no, the name of the variables you pass in doesn't matter.

1 Like