in reply to Copy XML file, write new attributes and move the old files.

A couple comments on the SQL. One, is that syntax valid? I don't know mysql, but "SELECT IF NOT EXISTS" is not valid SQL. EXISTS() returns a binary value and thus must be used in a WHERE clause or CASE expression. SELECT ... WHERE EXISTS() is the standard method. If that is an IF statement instead, the SELECT would appear later: IF EXISTS() THEN SELECT ... ELSE INSERT....

Two, the query is using variables to put create a dynamic SQL statement. Dynamic SQL is generally considered insecure. But, it can be easily avoided via placeholders and passing the values in the execute() statement.

  • Comment on Re: Copy XML file, write new attributes and move the old files.

Replies are listed 'Best First'.
Re^2: Copy XML file, write new attributes and move the old files.
by Nevamonk (Novice) on Jan 27, 2015 at 08:58 UTC

    not really what the question was about, i mainly posted the entire code to not confuse anyone, cq give all the information possible, the SQL would be debugged next.

    but then again, this is very helpful information, so thanks alot for taking the time to help a newbie out. i will look into it.