public int findWordLower(String lowerMatch) { do { if (nextWord() == null) { return -1; } if (lowerMatch.equals(lowerWord)) { return pos - lowerWord.length(); } } while (true); }
public int findWordLower(String lowerMatch) { do { if (nextWord() == null) { return -1; } if (lowerMatch.equals(lowerWord)) { return pos - lowerWord.length(); } } while (true); }
public int findWordLower(String lowerMatch) { do { if (nextWord() == null) { return -1; } if (lowerMatch.equals(lowerWord)) { return pos - lowerWord.length(); } } while (true); }
public void parse() throws PersistenceException { parser.nextWord(); processInitial(); }
public void parse() throws PersistenceException { parser.nextWord(); processInitial(); }
private void readLimit() { try { String maxLimit = parser.nextWord(); maxRows = Integer.parseInt(maxLimit); String offsetKeyword = parser.nextWord(); if (offsetKeyword != null) { if (!parser.isMatch("offset")) { throw new PersistenceException("expected offset keyword but got " + parser.getWord()); } String firstRowLimit = parser.nextWord(); firstRow = Integer.parseInt(firstRowLimit); parser.nextWord(); } } catch (NumberFormatException e) { String msg = "Expected an integer for maxRows or firstRows in limit offset clause"; throw new PersistenceException(msg, e); } }
private void readLimit() { try { String maxLimit = parser.nextWord(); maxRows = Integer.parseInt(maxLimit); String offsetKeyword = parser.nextWord(); if (offsetKeyword != null) { if (!parser.isMatch("offset")) { throw new PersistenceException("expected offset keyword but got " + parser.getWord()); } String firstRowLimit = parser.nextWord(); firstRow = Integer.parseInt(firstRowLimit); parser.nextWord(); } } catch (NumberFormatException e) { String msg = "Expected an integer for maxRows or firstRows in limit offset clause"; throw new PersistenceException(msg, e); } }
private OrmQueryProperties readFindFetch() { boolean readAlias = false; String props = null; String path = parser.nextWord(); String token; while ((token = parser.nextWord()) != null) { if (!readAlias && parser.isMatch("as")) { // next token is alias parser.nextWord(); readAlias = true; } else if ('(' == token.charAt(0)) { props = token; parser.nextWord(); break; } else if (isFindFetchEnd()) { break; } else if (!readAlias) { readAlias = true; } else { throw new PersistenceException("Expected (props) or new 'fetch' 'where' but got " + token); } } if (props != null) { props = props.substring(1, props.length() - 1); } return new OrmQueryProperties(path, props); }
private OrmQueryProperties readFindFetch() { boolean readAlias = false; String props = null; String path = parser.nextWord(); String token = null; while ((token = parser.nextWord()) != null) { if (!readAlias && parser.isMatch("as")) { // next token is alias parser.nextWord(); readAlias = true; } else if ('(' == token.charAt(0)) { props = token; parser.nextWord(); break; } else if (isFindFetchEnd()) { break; } else if (!readAlias) { readAlias = true; } else { throw new PersistenceException("Expected (props) or new 'fetch' 'where' but got " + token); } } if (props != null) { props = props.substring(1, props.length() - 1); } return new OrmQueryProperties(path, props); }
private OrmQueryProperties readFindFetch() { boolean readAlias = false; String props = null; String path = parser.nextWord(); String token = null; while ((token = parser.nextWord()) != null) { if (!readAlias && parser.isMatch("as")) { // next token is alias parser.nextWord(); readAlias = true; } else if ('(' == token.charAt(0)) { props = token; parser.nextWord(); break; } else if (isFindFetchEnd()) { break; } else if (!readAlias) { readAlias = true; } else { throw new PersistenceException("Expected (props) or new 'fetch' 'where' but got " + token); } } if (props != null) { props = props.substring(1, props.length() - 1); } return new OrmQueryProperties(path, props); }
public OrmQueryDetail parse() throws PersistenceException { if (parser.isEmpty()) return detail; parser.nextWord(); processInitial(); return detail; }
private void readOrderBy() { // read the by parser.nextWord(); StringBuilder sb = new StringBuilder(); while (parser.nextWord() != null) { if (parser.isMatch("limit")) { break; } else { String w = parser.getWord(); if (!w.startsWith("(")) { sb.append(" "); } sb.append(w); } } rawOrderBy = sb.toString().trim(); if (!parser.isFinished()) { readLimit(); } }
private void readOrderBy() { // read the by parser.nextWord(); StringBuilder sb = new StringBuilder(); while (parser.nextWord() != null) { if (parser.isMatch("limit")) { break; } else { String w = parser.getWord(); if (!w.startsWith("(")) { sb.append(" "); } sb.append(w); } } rawOrderBy = sb.toString().trim(); if (!parser.isFinished()) { readLimit(); } }
private void readWhere() { int nextMode = 0; StringBuilder sb = new StringBuilder(); while ((parser.nextWord()) != null) { if (parser.isMatch("order", "by")) { nextMode = 1; break; } else if (parser.isMatch("limit")) { nextMode = 2; break; } else { sb.append(" ").append(parser.getWord()); } } String whereClause = sb.toString().trim(); if (whereClause.length() > 0) { rawWhereClause = whereClause; } if (nextMode == 1) { readOrderBy(); } else if (nextMode == 2) { readLimit(); } }
private void readWhere() { int nextMode = 0; StringBuilder sb = new StringBuilder(); while ((parser.nextWord()) != null) { if (parser.isMatch("order", "by")) { nextMode = 1; break; } else if (parser.isMatch("limit")) { nextMode = 2; break; } else { sb.append(" ").append(parser.getWord()); } } String whereClause = sb.toString().trim(); if (whereClause.length() > 0) { rawWhereClause = whereClause; } if (nextMode == 1) { readOrderBy(); } else if (nextMode == 2) { readLimit(); } }
String possibleDistinct = textParser.nextWord(); if ("distinct".equals(possibleDistinct)) { distinctPos = textParser.getPos() - 8;
String possibleDistinct = textParser.nextWord(); if ("distinct".equals(possibleDistinct)) { distinctPos = textParser.getPos() - 8;