Examples of StreamingViewResult


Examples of org.ektorp.StreamingViewResult

        if (firstRow > 1) {
            final int skip = firstRow - 1;
            query = query.skip(skip);
        }

        final StreamingViewResult streamingView = connector.queryForStreamingView(query);

        final SelectItem[] selectItems = MetaModelHelper.createSelectItems(columns);
        return new CouchDbDataSet(selectItems, streamingView);
    }
View Full Code Here

Examples of org.ektorp.StreamingViewResult

    }

    public static SimpleTableDef detectTable(CouchDbConnector connector) {
        final SortedMap<String, Set<ColumnType>> columnsAndTypes = new TreeMap<String, Set<ColumnType>>();

        final StreamingViewResult streamingView = connector.queryForStreamingView(new ViewQuery().allDocs().includeDocs(true)
                .limit(1000));
        try {
            final Iterator<Row> rowIterator = streamingView.iterator();
            while (safeHasNext(rowIterator)) {
                Row row = rowIterator.next();
                JsonNode doc = row.getDocAsNode();

                final Iterator<Entry<String, JsonNode>> fieldIterator = doc.getFields();
                while (fieldIterator.hasNext()) {
                    Entry<String, JsonNode> entry = fieldIterator.next();
                    String key = entry.getKey();

                    Set<ColumnType> types = columnsAndTypes.get(key);

                    if (types == null) {
                        types = EnumSet.noneOf(ColumnType.class);
                        columnsAndTypes.put(key, types);
                    }

                    JsonNode value = entry.getValue();
                    if (value == null || value.isNull()) {
                        // do nothing
                    } else if (value.isTextual()) {
                        types.add(ColumnType.VARCHAR);
                    } else if (value.isArray()) {
                        types.add(ColumnType.LIST);
                    } else if (value.isObject()) {
                        types.add(ColumnType.MAP);
                    } else if (value.isBoolean()) {
                        types.add(ColumnType.BOOLEAN);
                    } else if (value.isInt()) {
                        types.add(ColumnType.INTEGER);
                    } else if (value.isLong()) {
                        types.add(ColumnType.BIGINT);
                    } else if (value.isDouble()) {
                        types.add(ColumnType.DOUBLE);
                    }
                }

            }
        } finally {
            streamingView.close();
        }

        final String[] columnNames = new String[columnsAndTypes.size()];
        final ColumnType[] columnTypes = new ColumnType[columnsAndTypes.size()];
View Full Code Here

Examples of org.ektorp.StreamingViewResult

        if (firstRow > 1) {
            final int skip = firstRow - 1;
            query = query.skip(skip);
        }

        final StreamingViewResult streamingView = connector.queryForStreamingView(query);

        final SelectItem[] selectItems = MetaModelHelper.createSelectItems(columns);
        return new CouchDbDataSet(selectItems, streamingView);
    }
View Full Code Here

Examples of org.ektorp.StreamingViewResult

    }

    public static SimpleTableDef detectTable(CouchDbConnector connector) {
        final SortedMap<String, Set<ColumnType>> columnsAndTypes = new TreeMap<String, Set<ColumnType>>();

        final StreamingViewResult streamingView = connector.queryForStreamingView(new ViewQuery().allDocs().includeDocs(true)
                .limit(1000));
        try {
            final Iterator<Row> rowIterator = streamingView.iterator();
            while (rowIterator.hasNext()) {
                Row row = rowIterator.next();
                JsonNode doc = row.getDocAsNode();

                final Iterator<Entry<String, JsonNode>> fieldIterator = doc.getFields();
                while (fieldIterator.hasNext()) {
                    Entry<String, JsonNode> entry = fieldIterator.next();
                    String key = entry.getKey();

                    Set<ColumnType> types = columnsAndTypes.get(key);

                    if (types == null) {
                        types = EnumSet.noneOf(ColumnType.class);
                        columnsAndTypes.put(key, types);
                    }

                    JsonNode value = entry.getValue();
                    if (value == null || value.isNull()) {
                        // do nothing
                    } else if (value.isTextual()) {
                        types.add(ColumnType.VARCHAR);
                    } else if (value.isArray()) {
                        types.add(ColumnType.LIST);
                    } else if (value.isObject()) {
                        types.add(ColumnType.MAP);
                    } else if (value.isBoolean()) {
                        types.add(ColumnType.BOOLEAN);
                    } else if (value.isInt()) {
                        types.add(ColumnType.INTEGER);
                    } else if (value.isLong()) {
                        types.add(ColumnType.BIGINT);
                    } else if (value.isDouble()) {
                        types.add(ColumnType.DOUBLE);
                    }
                }

            }
        } finally {
            streamingView.close();
        }

        final String[] columnNames = new String[columnsAndTypes.size()];
        final ColumnType[] columnTypes = new ColumnType[columnsAndTypes.size()];
View Full Code Here

Examples of org.ektorp.StreamingViewResult

        if (firstRow > 1) {
            final int skip = firstRow - 1;
            query = query.skip(skip);
        }

        final StreamingViewResult streamingView = connector.queryForStreamingView(query);

        final SelectItem[] selectItems = MetaModelHelper.createSelectItems(columns);
        return new CouchDbDataSet(selectItems, streamingView);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.