Java Code Examples for org.mybatis.generator.api.IntrospectedColumn#isColumnNameDelimited()
The following examples show how to use
org.mybatis.generator.api.IntrospectedColumn#isColumnNameDelimited() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MyBatis3FormattingUtilities.java From mapper-generator-javafx with Apache License 2.0 | 6 votes |
/** * The phrase to use in a select list. If there is a table alias, the value will be * "alias.columnName as alias_columnName" * * @param introspectedColumn * the introspected column * @return the proper phrase */ public static String getSelectListPhrase( IntrospectedColumn introspectedColumn) { if (stringHasValue(introspectedColumn.getTableAlias())) { StringBuilder sb = new StringBuilder(); sb.append(getAliasedEscapedColumnName(introspectedColumn)); sb.append(" as "); if (introspectedColumn.isColumnNameDelimited()) { sb.append(introspectedColumn.getContext() .getBeginningDelimiter()); } sb.append(introspectedColumn.getTableAlias()); sb.append('_'); sb.append(introspectedColumn.getActualColumnName()); if (introspectedColumn.isColumnNameDelimited()) { sb.append(introspectedColumn.getContext().getEndingDelimiter()); } return sb.toString(); } else { return getEscapedColumnName(introspectedColumn); } }
Example 2
Source File: PostgisGeoPlugin.java From dolphin with Apache License 2.0 | 6 votes |
protected void checkAndReplaceOutput(List<IntrospectedColumn> columns, TextElement te) { String sql = te.getContent(); for(IntrospectedColumn column : columns){ if(column.getFullyQualifiedJavaType().getShortName().equals("Geometry")){ String columnStr = null; if(column.isColumnNameDelimited()){ columnStr = "\""+column.getActualColumnName()+"\""; }else{ columnStr = column.getActualColumnName(); } sql = StringUtils.replaceOnce(sql, columnStr, "ST_AsText("+columnStr+") as " + columnStr); //sql = sql.replace(column.getActualColumnName(), "ST_AsText("+column.getActualColumnName()+")"); // System.out.println(); // System.out.println(sql); } } try { FieldUtils.writeDeclaredField(te, "content", sql, true); } catch (IllegalAccessException e) { e.printStackTrace(); } }
Example 3
Source File: MyBatis3FormattingUtilities.java From mybatis-generator-plus with Apache License 2.0 | 6 votes |
/** * The aliased column name for a select statement generated by the example * clauses. This is not appropriate for selects in SqlMaps because the * column is not escaped for MyBatis. If there is a table alias, the value * will be alias.columnName. * * This method is used in the Example classes and the returned value will be * in a Java string. So we need to escape double quotes if they are the * delimiters. * * @return the aliased column name */ public static String getAliasedActualColumnName( IntrospectedColumn introspectedColumn) { StringBuilder sb = new StringBuilder(); if (stringHasValue(introspectedColumn.getTableAlias())) { sb.append(introspectedColumn.getTableAlias()); sb.append('.'); } if (introspectedColumn.isColumnNameDelimited()) { sb.append(escapeStringForJava(introspectedColumn .getContext().getBeginningDelimiter())); } sb.append(introspectedColumn.getActualColumnName()); if (introspectedColumn.isColumnNameDelimited()) { sb.append(escapeStringForJava(introspectedColumn .getContext().getEndingDelimiter())); } return sb.toString(); }
Example 4
Source File: MyBatis3FormattingUtilities.java From mybatis-generator-plus with Apache License 2.0 | 6 votes |
/** * The phrase to use in a select list. If there is a table alias, the value * will be "alias.columnName as alias_columnName" * * @return the proper phrase */ public static String getSelectListPhrase( IntrospectedColumn introspectedColumn) { if (stringHasValue(introspectedColumn.getTableAlias())) { StringBuilder sb = new StringBuilder(); sb.append(getAliasedEscapedColumnName(introspectedColumn)); sb.append(" as "); //$NON-NLS-1$ if (introspectedColumn.isColumnNameDelimited()) { sb.append(introspectedColumn.getContext() .getBeginningDelimiter()); } sb.append(introspectedColumn.getTableAlias()); sb.append('_'); sb.append(escapeStringForMyBatis3(introspectedColumn .getActualColumnName())); if (introspectedColumn.isColumnNameDelimited()) { sb.append(introspectedColumn.getContext().getEndingDelimiter()); } return sb.toString(); } else { return getEscapedColumnName(introspectedColumn); } }
Example 5
Source File: Ibatis2FormattingUtilities.java From mybatis-generator-plus with Apache License 2.0 | 6 votes |
/** * The aliased column name for a select statement generated by the example * clauses. This is not appropriate for selects in SqlMaps because the * column is not escaped for iBATIS. If there is a table alias, the value * will be alias.columnName. * * This method is used in the Example classes and the returned value will be * in a Java string. So we need to escape double quotes if they are the * delimiters. * * @return the aliased column name */ public static String getAliasedActualColumnName( IntrospectedColumn introspectedColumn) { StringBuilder sb = new StringBuilder(); if (stringHasValue(introspectedColumn.getTableAlias())) { sb.append(introspectedColumn.getTableAlias()); sb.append('.'); } if (introspectedColumn.isColumnNameDelimited()) { sb.append(escapeStringForJava(introspectedColumn .getContext().getBeginningDelimiter())); } sb.append(introspectedColumn.getActualColumnName()); if (introspectedColumn.isColumnNameDelimited()) { sb.append(escapeStringForJava(introspectedColumn .getContext().getEndingDelimiter())); } return sb.toString(); }
Example 6
Source File: Ibatis2FormattingUtilities.java From mybatis-generator-plus with Apache License 2.0 | 6 votes |
/** * The phrase to use in a select list. If there is a table alias, the value * will be "alias.columnName as alias_columnName" * * @return the proper phrase */ public static String getSelectListPhrase( IntrospectedColumn introspectedColumn) { if (stringHasValue(introspectedColumn.getTableAlias())) { StringBuilder sb = new StringBuilder(); sb.append(getAliasedEscapedColumnName(introspectedColumn)); sb.append(" as "); //$NON-NLS-1$ if (introspectedColumn.isColumnNameDelimited()) { sb.append(introspectedColumn.getContext() .getBeginningDelimiter()); } sb.append(introspectedColumn.getTableAlias()); sb.append('_'); sb.append(escapeStringForIbatis2(introspectedColumn .getActualColumnName())); if (introspectedColumn.isColumnNameDelimited()) { sb.append(introspectedColumn.getContext().getEndingDelimiter()); } return sb.toString(); } else { return getEscapedColumnName(introspectedColumn); } }
Example 7
Source File: MyBatis3FormattingUtilities.java From mybatis-generator-core-fix with Apache License 2.0 | 6 votes |
/** * The aliased column name for a select statement generated by the example clauses. This is not appropriate for * selects in SqlMaps because the column is not escaped for MyBatis. If there is a table alias, the value will be * alias.columnName. * * This method is used in the Example classes and the returned value will be in a Java string. So we need to escape * double quotes if they are the delimiters. * * @param introspectedColumn * the introspected column * @return the aliased column name */ public static String getAliasedActualColumnName( IntrospectedColumn introspectedColumn) { StringBuilder sb = new StringBuilder(); if (stringHasValue(introspectedColumn.getTableAlias())) { sb.append(introspectedColumn.getTableAlias()); sb.append('.'); } if (introspectedColumn.isColumnNameDelimited()) { sb.append(escapeStringForJava(introspectedColumn .getContext().getBeginningDelimiter())); } sb.append(introspectedColumn.getActualColumnName()); if (introspectedColumn.isColumnNameDelimited()) { sb.append(escapeStringForJava(introspectedColumn .getContext().getEndingDelimiter())); } return sb.toString(); }
Example 8
Source File: MyBatis3FormattingUtilities.java From mybatis-generator-core-fix with Apache License 2.0 | 6 votes |
/** * The phrase to use in a select list. If there is a table alias, the value will be * "alias.columnName as alias_columnName" * * @param introspectedColumn * the introspected column * @return the proper phrase */ public static String getSelectListPhrase( IntrospectedColumn introspectedColumn) { if (stringHasValue(introspectedColumn.getTableAlias())) { StringBuilder sb = new StringBuilder(); sb.append(getAliasedEscapedColumnName(introspectedColumn)); sb.append(" as "); //$NON-NLS-1$ if (introspectedColumn.isColumnNameDelimited()) { sb.append(introspectedColumn.getContext() .getBeginningDelimiter()); } sb.append(introspectedColumn.getTableAlias()); sb.append('_'); sb.append(escapeStringForMyBatis3(introspectedColumn .getActualColumnName())); if (introspectedColumn.isColumnNameDelimited()) { sb.append(introspectedColumn.getContext().getEndingDelimiter()); } return sb.toString(); } else { return getEscapedColumnName(introspectedColumn); } }
Example 9
Source File: Ibatis2FormattingUtilities.java From mybatis-generator-core-fix with Apache License 2.0 | 6 votes |
/** * The aliased column name for a select statement generated by the example clauses. This is not appropriate for * selects in SqlMaps because the column is not escaped for iBATIS. If there is a table alias, the value will be * alias.columnName. * * This method is used in the Example classes and the returned value will be in a Java string. So we need to escape * double quotes if they are the delimiters. * * @param introspectedColumn * the introspected column * @return the aliased column name */ public static String getAliasedActualColumnName( IntrospectedColumn introspectedColumn) { StringBuilder sb = new StringBuilder(); if (stringHasValue(introspectedColumn.getTableAlias())) { sb.append(introspectedColumn.getTableAlias()); sb.append('.'); } if (introspectedColumn.isColumnNameDelimited()) { sb.append(escapeStringForJava(introspectedColumn .getContext().getBeginningDelimiter())); } sb.append(introspectedColumn.getActualColumnName()); if (introspectedColumn.isColumnNameDelimited()) { sb.append(escapeStringForJava(introspectedColumn .getContext().getEndingDelimiter())); } return sb.toString(); }
Example 10
Source File: Ibatis2FormattingUtilities.java From mybatis-generator-core-fix with Apache License 2.0 | 6 votes |
/** * The phrase to use in a select list. If there is a table alias, the value will be * "alias.columnName as alias_columnName" * * @param introspectedColumn * the introspected column * @return the proper phrase */ public static String getSelectListPhrase( IntrospectedColumn introspectedColumn) { if (stringHasValue(introspectedColumn.getTableAlias())) { StringBuilder sb = new StringBuilder(); sb.append(getAliasedEscapedColumnName(introspectedColumn)); sb.append(" as "); //$NON-NLS-1$ if (introspectedColumn.isColumnNameDelimited()) { sb.append(introspectedColumn.getContext() .getBeginningDelimiter()); } sb.append(introspectedColumn.getTableAlias()); sb.append('_'); sb.append(escapeStringForIbatis2(introspectedColumn .getActualColumnName())); if (introspectedColumn.isColumnNameDelimited()) { sb.append(introspectedColumn.getContext().getEndingDelimiter()); } return sb.toString(); } else { return getEscapedColumnName(introspectedColumn); } }
Example 11
Source File: MyBatis3FormattingUtilities.java From mapper-generator-javafx with Apache License 2.0 | 6 votes |
/** * The aliased column name for a select statement generated by the example clauses. This is not appropriate for * selects in SqlMaps because the column is not escaped for MyBatis. If there is a table alias, the value will be * alias.columnName. * * <p>This method is used in the Example classes and the returned value will be in a Java string. * So we need to escape double quotes if they are the delimiters. * * @param introspectedColumn * the introspected column * @return the aliased column name */ public static String getAliasedActualColumnName( IntrospectedColumn introspectedColumn) { StringBuilder sb = new StringBuilder(); if (stringHasValue(introspectedColumn.getTableAlias())) { sb.append(introspectedColumn.getTableAlias()); sb.append('.'); } if (introspectedColumn.isColumnNameDelimited()) { sb.append(escapeStringForJava(introspectedColumn .getContext().getBeginningDelimiter())); } sb.append(introspectedColumn.getActualColumnName()); if (introspectedColumn.isColumnNameDelimited()) { sb.append(escapeStringForJava(introspectedColumn .getContext().getEndingDelimiter())); } return sb.toString(); }
Example 12
Source File: MyBatis3FormattingUtilities.java From mybatis-generator-core-fix with Apache License 2.0 | 5 votes |
/** * Gets the escaped column name. * * @param introspectedColumn * the introspected column * @return the escaped column name */ public static String getEscapedColumnName( IntrospectedColumn introspectedColumn) { StringBuilder sb = new StringBuilder(); sb.append(escapeStringForMyBatis3(introspectedColumn .getActualColumnName())); if (introspectedColumn.isColumnNameDelimited()) { sb.insert(0, introspectedColumn.getContext() .getBeginningDelimiter()); sb.append(introspectedColumn.getContext().getEndingDelimiter()); } return sb.toString(); }
Example 13
Source File: DatabaseIntrospector.java From mybatis-generator-plus with Apache License 2.0 | 5 votes |
private boolean isMatchedColumn(IntrospectedColumn introspectedColumn, GeneratedKey gk) { if (introspectedColumn.isColumnNameDelimited()) { return introspectedColumn.getActualColumnName().equals(gk.getColumn()); } else { return introspectedColumn.getActualColumnName().equalsIgnoreCase(gk.getColumn()); } }
Example 14
Source File: Ibatis2FormattingUtilities.java From mybatis-generator-plus with Apache License 2.0 | 5 votes |
public static String getEscapedColumnName( IntrospectedColumn introspectedColumn) { StringBuilder sb = new StringBuilder(); sb.append(escapeStringForIbatis2(introspectedColumn .getActualColumnName())); if (introspectedColumn.isColumnNameDelimited()) { sb.insert(0, introspectedColumn.getContext() .getBeginningDelimiter()); sb.append(introspectedColumn.getContext().getEndingDelimiter()); } return sb.toString(); }
Example 15
Source File: Ibatis2FormattingUtilities.java From mybatis-generator-core-fix with Apache License 2.0 | 5 votes |
/** * Gets the escaped column name. * * @param introspectedColumn * the introspected column * @return the escaped column name */ public static String getEscapedColumnName( IntrospectedColumn introspectedColumn) { StringBuilder sb = new StringBuilder(); sb.append(escapeStringForIbatis2(introspectedColumn .getActualColumnName())); if (introspectedColumn.isColumnNameDelimited()) { sb.insert(0, introspectedColumn.getContext() .getBeginningDelimiter()); sb.append(introspectedColumn.getContext().getEndingDelimiter()); } return sb.toString(); }
Example 16
Source File: MyBatis3FormattingUtilities.java From mybatis-generator-plus with Apache License 2.0 | 5 votes |
public static String getEscapedColumnName( IntrospectedColumn introspectedColumn) { StringBuilder sb = new StringBuilder(); sb.append(escapeStringForMyBatis3(introspectedColumn .getActualColumnName())); if (introspectedColumn.isColumnNameDelimited()) { sb.insert(0, introspectedColumn.getContext() .getBeginningDelimiter()); sb.append(introspectedColumn.getContext().getEndingDelimiter()); } return sb.toString(); }
Example 17
Source File: MyBatis3FormattingUtilities.java From mapper-generator-javafx with Apache License 2.0 | 5 votes |
public static String getEscapedColumnName( IntrospectedColumn introspectedColumn) { StringBuilder sb = new StringBuilder(); sb.append(introspectedColumn.getActualColumnName()); if (introspectedColumn.isColumnNameDelimited()) { sb.insert(0, introspectedColumn.getContext() .getBeginningDelimiter()); sb.append(introspectedColumn.getContext().getEndingDelimiter()); } return sb.toString(); }
Example 18
Source File: DatabaseIntrospector.java From mapper-generator-javafx with Apache License 2.0 | 5 votes |
private boolean isMatchedColumn(IntrospectedColumn introspectedColumn, GeneratedKey gk) { if (introspectedColumn.isColumnNameDelimited()) { return introspectedColumn.getActualColumnName().equals(gk.getColumn()); } else { return introspectedColumn.getActualColumnName().equalsIgnoreCase(gk.getColumn()); } }
Example 19
Source File: DatabaseIntrospector.java From mybatis-generator-core-fix with Apache License 2.0 | 3 votes |
/** * Checks if is matched column. * * @param introspectedColumn * the introspected column * @param gk * the gk * @return true, if is matched column */ private boolean isMatchedColumn(IntrospectedColumn introspectedColumn, GeneratedKey gk) { if (introspectedColumn.isColumnNameDelimited()) { return introspectedColumn.getActualColumnName().equals(gk.getColumn()); } else { return introspectedColumn.getActualColumnName().equalsIgnoreCase(gk.getColumn()); } }