Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-03-13 17:10:02 +0000
committerEike Stepper2010-03-13 17:10:02 +0000
commit72090604b2546dc8f2369b3924116b29d98b33b8 (patch)
tree311d91dcea415cf41db28e08fd67012c86249ec2 /plugins/org.eclipse.net4j.db.mysql
parente2fba9bb3a2edaf28abac46bb3eae3149708e1c1 (diff)
downloadcdo-72090604b2546dc8f2369b3924116b29d98b33b8.tar.gz
cdo-72090604b2546dc8f2369b3924116b29d98b33b8.tar.xz
cdo-72090604b2546dc8f2369b3924116b29d98b33b8.zip
[256936] Support for Offline Mode
https://bugs.eclipse.org/bugs/show_bug.cgi?id=256936
Diffstat (limited to 'plugins/org.eclipse.net4j.db.mysql')
-rw-r--r--plugins/org.eclipse.net4j.db.mysql/src/org/eclipse/net4j/db/mysql/MYSQLAdapter.java58
1 files changed, 1 insertions, 57 deletions
diff --git a/plugins/org.eclipse.net4j.db.mysql/src/org/eclipse/net4j/db/mysql/MYSQLAdapter.java b/plugins/org.eclipse.net4j.db.mysql/src/org/eclipse/net4j/db/mysql/MYSQLAdapter.java
index 28f2bf6701..829737e4f3 100644
--- a/plugins/org.eclipse.net4j.db.mysql/src/org/eclipse/net4j/db/mysql/MYSQLAdapter.java
+++ b/plugins/org.eclipse.net4j.db.mysql/src/org/eclipse/net4j/db/mysql/MYSQLAdapter.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Eike Stepper - initial API and implementation
*/
@@ -21,7 +21,6 @@ import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
import javax.sql.DataSource;
import java.sql.SQLException;
-import java.util.StringTokenizer;
/**
* @author Eike Stepper
@@ -140,59 +139,4 @@ public class MYSQLAdapter extends DBAdapter
return super.isTypeIndexable(type);
}
}
-
- @Override
- public void appendValue(StringBuilder builder, IDBField field, Object value)
- {
- Object newValue = value;
-
- if (value instanceof String)
- {
- // MySQL does Java-Style backslash-escaping
- String str = (String)value;
- StringTokenizer st = new StringTokenizer(str, "\\\'", true); // split on backslash or single quote //$NON-NLS-1$
- StringBuilder newValueBuilder = new StringBuilder();
-
- while (st.hasMoreTokens())
- {
- String current = st.nextToken();
- if (current.length() == 0)
- {
- continue;
- }
-
- if (current.length() > 1) // >1 -> can not be token -> normal string
- {
- newValueBuilder.append(current);
- }
- else
- { // length == 1
- newValueBuilder.append(processEscape(current.charAt(0)));
- }
- }
-
- newValue = newValueBuilder.toString();
- }
- else if (value instanceof Character)
- {
- newValue = processEscape((Character)value);
- }
-
- super.appendValue(builder, field, newValue);
- }
-
- private Object processEscape(char c)
- {
- if (c == '\\') // one backslash -->
- {
- return "\\\\"; // results in two backslashes //$NON-NLS-1$
- }
-
- if (c == '\'') // one single quote -->
- {
- return "\\'"; // results in backslash+single quote //$NON-NLS-1$
- }
-
- return c; // no escape character --> return as is
- }
}

Back to the top