private void appendCount(StringBuilder queryString) { queryString.append(SPACE).append("COUNT").append(LEFTBRACE+quoteIfRequired(count)+RIGHTBRACE); if(selectColumn != null){ queryString.append(COMMA).append(SPACE).append(selectColumn); } }
/** * Sets the specific columns to be returned. * @param selections Variable length array of column names * @return A builder object with which you can construct the rest of the CDS query */ public SelectColumnBuilder selectColumns(final String... selections){ String currentSelect = StringUtils.join(selections, COMMA); currentSelect = quoteIfRequired(currentSelect.replace(COMMA, quoteIfRequired(SPACE+COMMA+SPACE))); this.selectColumn = this.selectColumn == null ? currentSelect : this.selectColumn.concat(SPACE+COMMA+SPACE + currentSelect); return new SelectColumnBuilder(this); }
/** * Sets the column based on which the condition is created. * @param columnName Name of the column * @return A builder with which you can set the operator and operand of the condition */ public OperatorBuilder columnName(String columnName){ condition.append(quoteIfRequired(columnName)); return new OperatorBuilder(condition); }
/** * Sets the column name based on which the result is ordered. * @param orderBy Name of the column for ordering the result * @param isDescending Indicates whether the result is in the descending order * @return A builder object with which you can construct the rest of the CDS query */ public OrderByBuilder orderBy(String orderBy, boolean isDescending){ if(orderBy != null && orderBy.length() > 0){ String orderByWithQoutes = quoteIfRequired(orderBy); String orderByStr = isDescending ? orderByWithQoutes.concat(SPACE).concat("DESC") : orderByWithQoutes.concat(SPACE).concat("ASC"); this.orderBy = this.orderBy == null ? orderByStr : this.orderBy.concat(COMMA + orderByStr); } return new OrderByBuilder(this); }
/** * Sets the column based on which the condition is created. You can also apply a function to the specified column, such as * UCASE or LCASE. * @param columnName Name of the column * @param function An enum specifying the function to be applied to the column * @return A builder with which you can set the operator and operand of the condition */ public OperatorBuilder columnName(String columnName, Functions function){ String quotedColumnName = quoteIfRequired(columnName); condition.append(function.toString().concat(LEFTBRACE).concat(quotedColumnName).concat(RIGHTBRACE)); return new OperatorBuilder(condition); }
queryString.append(SPACE).append("GROUP BY").append(SPACE).append(quoteIfRequired(groupBy)); if(having != null){ queryString.append(SPACE).append("HAVING").append(SPACE).append(having);
static String getPersistenceName(String fqEntityName, String elementName) { String persistenceName = null; if(isHdbcdsMode == null) isHdbcdsMode = CSNUtil.isHdbcdsMapping(); if(isHdbcdsMode) persistenceName = CSNUtil.getPersistenceName(fqEntityName, elementName); if (persistenceName == null) if (elementName != null) persistenceName = elementName; else persistenceName = replaceDotIfRequired(fqEntityName); return quoteIfRequired(persistenceName); }
keyValues.add(e.getValue()); condition.append(quoteIfRequired(key) + " = ?");
int[] rowsAffected; String insertSqlStart = "INSERT INTO " + quoteIfRequired(nameSpace + getSeparator() + createEntityInfoList.get(0).getEntityName()); Map<String, Object> fcstd = generateFlatColumnStructure(createEntityInfoList.get(0).getColumns()); LinkedHashSet<String> columnNames = (LinkedHashSet<String>) CSNUtil.getProperties(nameSpace,