Package com.totsp.gwittir.client.util.html5db

Examples of com.totsp.gwittir.client.util.html5db.ResultsCallback


      final Map<String, String> windowContextData) {
                db.run(
                        new TransactionTask() {

                            public void run(Transaction tx) {
                               tx.execute("DELETE FROM windowcontext ", new String[0], new ResultsCallback(){

                                public void onSuccess(Transaction tx, ResultSet rs) {

                                      for (Entry<String, String> entry : windowContextData.entrySet()) {
                                            tx
                                                            .execute(
                                                                            "INSERT INTO windowcontext (key, value) VALUES ( ?, ? )",
                                                                            new String[] { entry.getKey(),
                                                                                            entry.getValue() },
                                                                            new ResultsCallback() {

                                                                                    public void onFailure(Transaction tx,
                                                                                                    SQLError error) {
                                                                                            Window.alert("Insertion failure "
                                                                                                            + error.getMessage());
View Full Code Here


    db = Databases.openDatabase("gwittir-windowcontext", "1.0",
        "This gwittir window context database", QUOTA);
    db.run(new TransactionTask() {
      public void run(Transaction tx) {
        tx.execute("SELECT COUNT(*) FROM windowcontext", null,
            new ResultsCallback() {
              public void onSuccess(Transaction tx, ResultSet rs) {
                                                                GWT.log("windowcontext found", null);
                tx.execute(
                    "SELECT key, value FROM windowcontext",
                    new Object[0], new ResultsCallback() {

                      public void onSuccess(
                          Transaction tx, ResultSet rs) {
                                                                                                try{
                                                                                                GWT.log("Loading "+rs.getRowCount(), null);
                        for (JavaScriptObjectDecorator d : rs
                            .getRows()) {
                                                                                                        loaded.put(d.getStringProperty("key"),
                               d.getStringProperty("value"));
                         
                        }
                                                                                                listener.onInitialized();
                                                                                                } catch(Exception e){
                                                                                                    GWT.log(null,e);
                                                                                                }
                      }

                      public void onFailure(
                          Transaction tx,
                          SQLError error) {
                        Window.alert("Select failed");
                      }

                    });
              }

              public void onFailure(Transaction tx, SQLError error) {
                tx
                    .execute(
                        "CREATE TABLE IF NOT EXISTS windowcontext (key TEXT, value TEXT)",
                        null, new ResultsCallback() {
                          public void onSuccess(
                              Transaction tx,
                              ResultSet rs) {
                            listener
                                .onInitialized();
View Full Code Here

        Database db = Databases.openDatabase("gwittir-windowcontext", "1.0",
                "This is the gwittir test db", 512000);
        db.run(new TransactionTask() {
                public void run(Transaction tx) {
                    tx.execute("SELECT COUNT(*) FROM Gwittir", null,
                        new ResultsCallback() {
                            public void onSuccess(Transaction tx, ResultSet rs) {
                                Window.alert("Worked!");
                                tx.execute("SELECT id, note FROM Gwittir", null,  new ResultsCallback(){

                            public void onSuccess(Transaction tx, ResultSet rs) {
                                for(JavaScriptObjectDecorator d: rs.getRows()){
                                    Window.alert( "Got:  "+d.getIntegerProperty("id")+" :: "+d.getStringProperty("note"));
                                }
                            }

                            public void onFailure(Transaction tx, SQLError error) {
                                Window.alert("Select failed");
                            }

                                });
                            }

                            public void onFailure(Transaction tx, SQLError error) {
                                tx.execute("CREATE TABLE Gwittir (id REAL UNIQUE, note TEXT)",
                                    null,
                                    new ResultsCallback() {
                                        public void onSuccess(Transaction tx,
                                            ResultSet rs) {
                                            Window.alert("Database created.");

                                            Object[] parameters = new Object[2];
                                            parameters[0] = 1;
                                            parameters[1] = "This is a test of the emergency broadcast system";
                                            tx.execute("INSERT INTO Gwittir (id, note) VALUES (?, ?)",
                                                parameters,
                                                new ResultsCallback() {
                                                    public void onSuccess(
                                                        Transaction tx,
                                                        ResultSet rs) {
                                                        Window.alert(
                                                            "Insert Succeeded.");
View Full Code Here

          tx
              .execute(
                  "INSERT INTO windowcontext (key, value) VALUES ( ?, ? )",
                  new String[] { entry.getKey(),
                      entry.getValue() },
                  new ResultsCallback() {

                    public void onFailure(Transaction tx,
                        SQLError error) {
                      Window.alert("Insertion failure "
                          + error.getMessage());
View Full Code Here

    db = Databases.openDatabase("gwittir-windowcontext", "1.0",
        "This gwittir window context database", QUOTA);
    db.run(new TransactionTask() {
      public void run(Transaction tx) {
        tx.execute("SELECT COUNT(*) FROM windowcontext", null,
            new ResultsCallback() {
              public void onSuccess(Transaction tx, ResultSet rs) {
                tx.execute(
                    "SELECT key, value FROM windowcontext",
                    null, new ResultsCallback() {

                      public void onSuccess(
                          Transaction tx, ResultSet rs) {
                        for (JavaScriptObjectDecorator d : rs
                            .getRows()) {
                          loaded
                              .put(
                                  d
                                      .getStringProperty("key"),
                                  d
                                      .getStringProperty("value"));
                          listener.onInitialized();
                        }
                      }

                      public void onFailure(
                          Transaction tx,
                          SQLError error) {
                        Window.alert("Select failed");
                      }

                    });
              }

              public void onFailure(Transaction tx, SQLError error) {
                tx
                    .execute(
                        "CREATE TABLE IF NOT EXISTS windowcontext (key TEXT, value TEXT)",
                        null, new ResultsCallback() {
                          public void onSuccess(
                              Transaction tx,
                              ResultSet rs) {
                            listener
                                .onInitialized();
View Full Code Here

TOP

Related Classes of com.totsp.gwittir.client.util.html5db.ResultsCallback

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.