X-Git-Url: http://git.phpeclipse.com diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/QuantumUtil.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/QuantumUtil.java new file mode 100644 index 0000000..c789923 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/QuantumUtil.java @@ -0,0 +1,47 @@ +/* + * Created on 24/08/2003 + * + */ +package com.quantum.util; + +import java.util.StringTokenizer; + +/** + * @author panic + * + */ +public class QuantumUtil { + /** + * Gets the first string in a string with the structure XXXX.XXXX + * @param qualifiedName + * @return The schema name if present, else an empty string ("") + */ + public static String getSchemaName(String qualifiedName) { + StringTokenizer st = new StringTokenizer(qualifiedName, "."); //$NON-NLS-1$ + if (st.countTokens() > 1) { + return st.nextToken(); + } else + return ""; + } + + /** + * Gets the second string in a string with the structure XXXX.XXXX + * @param qualifiedName + * @return The table name if present, else the received parameter + */ + public static String getTableName(String qualifiedName) { + StringTokenizer st = new StringTokenizer(qualifiedName, "."); //$NON-NLS-1$ + if (st.countTokens() > 1) { + st.nextToken(); + return st.nextToken(); + } else + return qualifiedName; + } + + public static String trasposeEscape(String untrans){ + String trasposed = StringUtil.substituteString(untrans, "\\n", "\n"); + trasposed = StringUtil.substituteString(trasposed, "\\t", "\t"); + + return trasposed; + } +}