Package com.almworks.sqlite4java

Examples of com.almworks.sqlite4java.SQLiteStatement.step()


        } else {
            db.open(true);
        }
        // set 1GB cache_size:
        final SQLiteStatement stmt = db.prepare("PRAGMA page_size;");
        if (stmt.step()) {
            long cacheSize = stmt.columnLong(0);
            db.exec("PRAGMA cache_size = " + (1024l*1024l*1024l / cacheSize) + ";");
        }
        stmt.dispose();
        db.exec("PRAGMA synchronous = OFF;");
View Full Code Here


                    stmt = db.prepare("SELECT cat.title, page.title FROM categories as categories " +
                            "INNER JOIN pages AS cat ON categories.category == cat.id " +
                            "INNER JOIN pages AS page ON categories.page == page.id;");
                    String category0 = null;
                    List<String> catPageList = new ArrayList<String>(1000);
                    while (stmt.step()) {
                        final String stmtCat0 = stmt.columnString(0);
                        final String stmtPage0 = stmt.columnString(1);
                        final String stmtPage = wikiModel.normalisePageTitle(stmtPage0);
                        if (category0 == null) {
                            category0 = stmtCat0;
View Full Code Here

                    stmt = db.prepare("SELECT tpl.title, page.title FROM templates as templates " +
                            "INNER JOIN pages AS tpl ON templates.template == tpl.id " +
                            "INNER JOIN pages AS page ON templates.page == page.id;");
                    String template0 = null;
                    List<String> tplPageList = new ArrayList<String>(1000);
                    while (stmt.step()) {
                        final String stmtTpl0 = stmt.columnString(0);
                        final String stmtPage0 = stmt.columnString(1);
                        final String stmtPage = wikiModel.normalisePageTitle(stmtPage0);
                        if (template0 == null) {
                            template0 = stmtTpl0;
View Full Code Here

                    stmt = db.prepare("SELECT lnkDest.title, lnkSrc.title FROM links as links " +
                            "INNER JOIN pages AS lnkDest ON links.lnkDest == lnkDest.id " +
                            "INNER JOIN pages AS lnkSrc ON links.lnkSrc == lnkSrc.id;");
                    String linkDest0 = null;
                    List<String> backLinksPageList = new ArrayList<String>(1000);
                    while (stmt.step()) {
                        final String stmtLnkDest0 = stmt.columnString(0);
                        final String stmtLnkSrc0 = stmt.columnString(1);
                        final String stmtLnkSrc = wikiModel.normalisePageTitle(stmtLnkSrc0);
                        if (linkDest0 == null) {
                            linkDest0 = stmtLnkDest0;
View Full Code Here

    public void writeToScalaris() {
        println("Importing key/value pairs to Scalaris...");
        try {
            importStart();
            SQLiteStatement st = db.prepare("SELECT scalaris_key FROM objects;");
            while (st.step()) {
                String key = st.columnString(0);
                writeToScalaris(key, WikiDumpPrepareSQLiteForScalarisHandler.readObject(stRead, key));
            }
            st.dispose();
            // some requests may be left over
View Full Code Here

            stmt = db
                    .prepare("SELECT page.title, tpl.title FROM " +
                            "templates INNER JOIN pages AS page ON templates.title == page.id " +
                            "INNER JOIN pages AS tpl ON templates.template == tpl.id " +
                            "WHERE page.title LIKE '" + wikiModel.normalisePageTitle(wikiModel.getTemplateNamespace() + ":") + "%';");
            while (stmt.step()) {
                String pageTitle = stmt.columnString(0);
                String template = stmt.columnString(1);
                updateMap(templateTree, pageTitle, template);
            }
            stmt.dispose();
View Full Code Here

            stmt.dispose();
            stmt = db
                    .prepare("SELECT page.title, incl.title FROM " +
                            "includes INNER JOIN pages AS page ON includes.title == page.id " +
                            "INNER JOIN pages AS incl ON includes.include == incl.id;");
            while (stmt.step()) {
                String pageTitle = stmt.columnString(0);
                String include = stmt.columnString(1);
                updateMap(includeTree, pageTitle, include);
            }
            stmt.dispose();
View Full Code Here

            stmt.dispose();
            stmt = db
                    .prepare("SELECT page.title, redir.title FROM " +
                            "redirects INNER JOIN pages AS page ON redirects.title == page.id " +
                            "INNER JOIN pages AS redir ON redirects.redirect == redir.id;");
            while (stmt.step()) {
                String pageTitle = stmt.columnString(0);
                String redirect = stmt.columnString(1);
                updateMap(referenceTree, redirect, pageTitle);
            }
        } catch (SQLiteException e) {
View Full Code Here

                            .prepare("SELECT page.title FROM categories " +
                                    "INNER JOIN currentPages AS cp ON categories.category == cp.id " +
                                    "INNER JOIN pages AS page ON categories.title == page.id " +
                                    // "INNER JOIN pages AS cat ON categories.category == cat.id" +
                                    "WHERE page.title LIKE '" + MyWikiModel.normalisePageTitle(nsObject.getCategory() + ":", nsObject) + "%';");
                    while (stmt.step()) {
                        String pageCategory = stmt.columnString(0);
                        addToPages(allowedCatsFull, newPages, pageCategory, includeTree, referenceTree);
                    }
                    stmt.dispose();
                    println(msgOut, "  adding sub-templates or sub-categories of " + currentPages.size() + " categories or templates");
View Full Code Here

                                    "INNER JOIN currentPages AS cp ON templates.template == cp.id " +
                                    "INNER JOIN pages AS page ON templates.title == page.id " +
                                    // "INNER JOIN pages AS tpl ON templates.template == tpl.id" +
                                    "WHERE page.title LIKE '" + MyWikiModel.normalisePageTitle(nsObject.getCategory() + ":", nsObject) + "%' OR "
                                    + "page.title LIKE '" + MyWikiModel.normalisePageTitle(nsObject.getTemplate() + ":", nsObject) + "%';");
                    while (stmt.step()) {
                        String pageTemplate = stmt.columnString(0);
                        Set<String> tplChildren = WikiDumpGetCategoryTreeHandler.getAllChildren(templateTree, pageTemplate);
                        addToPages(allowedCatsFull, newPages, tplChildren, includeTree, referenceTree);
                    }
                    stmt.dispose();
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.