Package net.mlw.vlh.adapter.hibernate3.util

Examples of net.mlw.vlh.adapter.hibernate3.util.StatementBuilder


      }
      else
      {
         LOGGER.info("Using decorator of the ScrollableResults with your validator.");
         _validator.setValueListInfo(info);
         results = new ScrollableResultsDecorator(query.scroll(), _validator);
      }

      return results;
   }
View Full Code Here


    */
   public StatementBuilder getStatementBuilder()
   {
      if (statementBuilder == null)
      {
         statementBuilder = new StatementBuilder();
      }
      return statementBuilder;
   }
View Full Code Here

        String name = method.name();
        if (skipMethod(method)) {
            return;
        }
        Parameter[] params = method.parameters();
        StatementBuilder buff = new StatementBuilder();
        buff.append('(');
        int i = 0;
        for (Parameter p : params) {
            boolean isVarArgs = method.isVarArgs() && i++ == params.length - 1;
            buff.appendExceptFirst(", ");
            buff.append(getTypeName(false, isVarArgs, p.type()));
            buff.append(' ');
            buff.append(p.name());
        }
        buff.append(')');
        ClassDoc[] exceptions = method.thrownExceptions();
        if (exceptions.length > 0) {
            buff.append(" throws ");
            buff.resetCount();
            for (ClassDoc ex : exceptions) {
                buff.appendExceptFirst(", ");
                buff.append(ex.typeName());
            }
        }
        if (isDeprecated(method)) {
            name = "<span class=\"deprecated\">" + name + "</span>";
        }
        writer.println("<a id=\"" + signature + "\" href=\"#" + signature + "\">" + name + "</a>" + buff.toString());
        boolean hasComment = method.commentText() != null && method.commentText().trim().length() != 0;
        writer.println("<div class=\"methodText\">" + formatText(method.commentText()) + "</div>");
        ParamTag[] paramTags = method.paramTags();
        ThrowsTag[] throwsTags = method.throwsTags();
        boolean hasThrowsTag = throwsTags != null && throwsTags.length > 0;
View Full Code Here

        send("PASV");
        readCode(226, 227);
        int first = message.indexOf('(') + 1;
        int last = message.indexOf(')');
        String[] address = StringUtils.arraySplit(message.substring(first, last), ',', true);
        StatementBuilder buff = new StatementBuilder();
        for (int i = 0; i < 4; i++) {
            buff.appendExceptFirst(".");
            buff.append(address[i]);
        }
        String ip = buff.toString();
        InetAddress addr = InetAddress.getByName(ip);
        int port = (Integer.parseInt(address[4]) << 8) | Integer.parseInt(address[5]);
        socketData = NetUtils.createSocket(addr, port, false);
        inData = socketData.getInputStream();
        outData = socketData.getOutputStream();
View Full Code Here

                        + ", " + quoteArray(types) + ");");
            }
            checkClosed();
            String tableType;
            if (types != null && types.length > 0) {
                StatementBuilder buff = new StatementBuilder("TABLE_TYPE IN(");
                for (int i = 0; i < types.length; i++) {
                    buff.appendExceptFirst(", ");
                    buff.append('?');
                }
                tableType = buff.append(')').toString();
            } else {
                tableType = "TRUE";
            }
            PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT "
                    + "TABLE_CATALOG TABLE_CAT, "
View Full Code Here

            checkClosed();
            PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT TOPIC "
                    + "FROM INFORMATION_SCHEMA.HELP WHERE SECTION = ?");
            prep.setString(1, section);
            ResultSet rs = prep.executeQuery();
            StatementBuilder buff = new StatementBuilder();
            while (rs.next()) {
                String s = rs.getString(1).trim();
                String[] array = StringUtils.arraySplit(s, ',', true);
                for (String a : array) {
                    buff.appendExceptFirst(",");
                    String f = a.trim();
                    if (f.indexOf(' ') >= 0) {
                        // remove 'Function' from 'INSERT Function'
                        f = f.substring(0, f.indexOf(' ')).trim();
                    }
                    buff.append(f);
                }
            }
            rs.close();
            prep.close();
            return buff.toString();
        } catch (Exception e) {
            throw logAndConvert(e);
        }
    }
View Full Code Here

        }
        condition = Expression.getRandomCondition(config, this).getSQL();
    }

    private Result select(DbInterface db) throws SQLException {
        StatementBuilder buff = new StatementBuilder("SELECT ");
        for (String s : selectList) {
            buff.appendExceptFirst(", ");
            buff.append(s);
        }
        buff.append("  FROM ").append(table.getName()).append(" M").
            append(' ').append(join);
        if (condition != null) {
            buff.append("  WHERE ").append(condition);
        }
        if (order.trim().length() > 0) {
            buff.append("  ORDER BY ").append(order);
        }
        return db.select(buff.toString());
    }
View Full Code Here

                        + ", " + quoteArray(types) + ");");
            }
            checkClosed();
            String tableType;
            if (types != null && types.length > 0) {
                StatementBuilder buff = new StatementBuilder("TABLE_TYPE IN(");
                for (int i = 0; i < types.length; i++) {
                    buff.appendExceptFirst(", ");
                    buff.append('?');
                }
                tableType = buff.append(')').toString();
            } else {
                tableType = "TRUE";
            }
            PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT "
                    + "TABLE_CATALOG TABLE_CAT, "
View Full Code Here

            checkClosed();
            PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT TOPIC "
                    + "FROM INFORMATION_SCHEMA.HELP WHERE SECTION = ?");
            prep.setString(1, section);
            ResultSet rs = prep.executeQuery();
            StatementBuilder buff = new StatementBuilder();
            while (rs.next()) {
                String s = rs.getString(1).trim();
                String[] array = StringUtils.arraySplit(s, ',', true);
                for (String a : array) {
                    buff.appendExceptFirst(",");
                    String f = a.trim();
                    if (f.indexOf(' ') >= 0) {
                        // remove 'Function' from 'INSERT Function'
                        f = f.substring(0, f.indexOf(' ')).trim();
                    }
                    buff.append(f);
                }
            }
            rs.close();
            prep.close();
            return buff.toString();
        } catch (Exception e) {
            throw logAndConvert(e);
        }
    }
View Full Code Here

                        }
                        writer.println(sql + ";");
                    } else {
                        String tableName = tableMap.get(storageId);
                        if (tableName != null) {
                            StatementBuilder buff = new StatementBuilder();
                            buff.append("INSERT INTO ").append(tableName).append(" VALUES(");
                            for (int i = 0; i < row.getColumnCount(); i++) {
                                buff.appendExceptFirst(", ");
                                buff.append(row.getValue(i).getSQL());
                            }
                            buff.append(");");
                            writer.println(buff.toString());
                        }
                    }
                }
            } else if (x == PageLog.REMOVE) {
                int sessionId = in.readVarInt();
                setStorage(in.readVarInt());
                long key = in.readVarLong();
                writer.println("-- session " + sessionId +
                        " table " + storageId +
                        " - " + key);
                if (transactionLog) {
                    if (storageId == 0) {
                        int tableId = (int) key;
                        String tableName = tableMap.get(tableId);
                        if (tableName != null) {
                            writer.println("DROP TABLE IF EXISTS " + tableName + ";");
                        }
                    } else {
                        String tableName = tableMap.get(storageId);
                        if (tableName != null) {
                            String sql = "DELETE FROM " + tableName + " WHERE _ROWID_ = " + key + ";";
                            writer.println(sql);
                        }
                    }
                }
            } else if (x == PageLog.TRUNCATE) {
                int sessionId = in.readVarInt();
                setStorage(in.readVarInt());
                writer.println("-- session " + sessionId +
                        " table " + storageId +
                        " truncate");
                if (transactionLog) {
                    writer.println("TRUNCATE TABLE " + storageId);
                }
            } else if (x == PageLog.COMMIT) {
                int sessionId = in.readVarInt();
                writer.println("-- commit " + sessionId);
            } else if (x == PageLog.ROLLBACK) {
                int sessionId = in.readVarInt();
                writer.println("-- rollback " + sessionId);
            } else if (x == PageLog.PREPARE_COMMIT) {
                int sessionId = in.readVarInt();
                String transaction = in.readString();
                writer.println("-- prepare commit " + sessionId + " " + transaction);
            } else if (x == PageLog.NOOP) {
                // nothing to do
            } else if (x == PageLog.CHECKPOINT) {
                writer.println("-- checkpoint");
            } else if (x == PageLog.FREE_LOG) {
                int size = in.readVarInt();
                StringBuilder buff = new StringBuilder("-- free");
                for (int i = 0; i < size; i++) {
                    buff.append(' ').append(in.readVarInt());
                }
                writer.println(buff);
            } else {
                writer.println("-- ERROR: unknown operation " + x);
                break;
View Full Code Here

TOP

Related Classes of net.mlw.vlh.adapter.hibernate3.util.StatementBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.