Saving a textfield with a single quote to Oracle

When saving a textfield with eg the contents O’Hara to Oracle processing halts with a ORA-00933 error complaining the SQL ended premature.

Why is this?

Oracle offers the Q-quote operator for this and I wonder why the Scriptcase system is not using this. Trying to use it yourself in the sql-statement gives no positive results. ORA 00933 errors keep coming.

I found a workaround by using str_replace and replacing the single quote with 2 single quotes. Then it works flawless. But to be frank I find this a silly and cumbersome solution. The system should do it.

Would it be possible for Scriptcase to have a look into this glitch?

[QUOTE=scriptfan;39851]When saving a textfield with eg the contents O’Hara to Oracle processing halts with a ORA-00933 error complaining the SQL ended premature.

Why is this?

Oracle offers the Q-quote operator for this and I wonder why the Scriptcase system is not using this. Trying to use it yourself in the sql-statement gives no positive results. ORA 00933 errors keep coming.

I found a workaround by using str_replace and replacing the single quote with 2 single quotes. Then it works flawless. But to be frank I find this a silly and cumbersome solution. The system should do it.

Would it be possible for Scriptcase to have a look into this glitch?[/QUOTE]

In general this is a common problem to databases. In PHP there’s a statement you could use, i.e. in the onvalidate:

http://php.net/manual/en/function.addslashes.php

Searching the forum I found this addslashes solution and tried it, but it didn’t work. Still the ORA 0933 error.

Apparently Oracle doesn’t like the backslash as an escape character. Then I found by accident the single quote escape.