Permalink
Browse files

Android pigeon working & feature complete

  • Loading branch information...
1 parent 616e275 commit 9036fb20af60599a076e358a8ca7b2af9a7a33e1 alunny committed Nov 9, 2009
@@ -8,7 +8,6 @@
<script type="text/javascript" src="script/phonegap.js"></script>
<script type="text/javascript" src="script/xui-min.js"></script>
<script type="text/javascript" src="script/pigeon.js"></script>
- <script type="text/javascript" src="script/sql.js"></script>
<link rel="stylesheet" type="text/css" href="master.css" media="screen" />
</head>
<body>
@@ -112,9 +112,9 @@ var post_tweet = function(status,user,passw,container_id) {
{ callback: function() { render_new_tweet(this.responseText); },
headers: [{name:"Authorization",
value: "Basic " + btoa(user + ":" + passw)},
- {name:"Content-Length",
- value: params.length},
- {name:"Content-type",
+ // {name:"Content-Length",
+ // value: "" + params.length},
+ {name:"Content-Type",
value:"application/x-www-form-urlencoded"},
{name:"Connection",
value: "close"}],
@@ -125,6 +125,7 @@ var post_tweet = function(status,user,passw,container_id) {
}
var render_new_tweet = function(new_tweet) {
+ console.log(new_tweet);
try {
tweet_response = eval("[" + new_tweet + "]");
} catch (e) {
@@ -192,8 +193,8 @@ var login_function = function(e) {
x$.data.m_user = x$("#user_field").elements[0].value;
x$.data.m_pass = x$("#pass_field").elements[0].value;
- sql.post("user",x$.data.m_user);
- sql.post("password",x$.data.m_pass);
+// sql.post("user",x$.data.m_user);
+// sql.post("password",x$.data.m_pass);
load_tweets("#content",x$.data.m_user,x$.data.m_pass);
show_panel("#content"); // failing?
@@ -1,87 +0,0 @@
-/**
-* XUI SQL
-* ---
-*
-* RESTFUL (like) SQL Lite Wrapper for Storing Data - Key Value Pair
-*/
-
-var sql = function() {
- var dbName = 'storeDB';
- var version = '1.0';
- var dbTable = 'storeDBTbl';
- var displayName = 'STORE-SQL';
- var maxSize = 65536;
- var db = null;
-
- var defaultErrorHandle = function(tx,error){ console.log(error.message); }
- var defaultDataHandle = function(result){ console.log(result); }
-
- var now = function() { return new Date().getTime(); }
-
- return {
- setup: function(){
- var setupTable = function(tx,error) {
- tx.executeSql("CREATE TABLE "+ dbTable + " (key NVARCHAR(32) UNIQUE, value TEXT, timestamp REAL)", [], function(result) {}, defaultErrorHandle);
- }
-
- if (window.openDatabase) {
- db = openDatabase(dbName, version, displayName, maxSize);
- db.transaction(function(tx) {
- tx.executeSql("SELECT COUNT(*) FROM " + dbTable , [], function(){}, setupTable
- )});
-
- } else {
- console.log("Error Could not create DB either the DB has exceeded its size limit or you are using the wrong browser.");
- }
-
- return this;
- },
-
- // alias for SELECT
- get: function(key,fnc) {
- if (typeof fnc != 'function') return;
- db.transaction(function(tx) {
- tx.executeSql("SELECT value FROM " + dbTable + " WHERE key = ?",[key],function(tx,results) {
- if (results.rows.length == 1) {
- fnc(results.rows.item(0).value);
- } else {
- fnc(null);
- }
- }, defaultErrorHandle);
- });
- },
-
- // alias for INSERT
- post: function(key, value){
- db.transaction(function(tx) {
- tx.executeSql("INSERT INTO " + dbTable + " (key,value,timestamp) VALUES (?,?,?)",[key,value,now()],defaultDataHandle,defaultErrorHandle);
- });
- },
-
- // alias for DELETE JavaScript 'delete' is a reserved word
- del: function(key){
- db.transaction(function(tx) {
- tx.executeSql("DELETE FROM " + dbTable + " WHERE key = ? ",[key], defaultDataHandle,defaultErrorHandle);
- });
- },
-
- // alias for UPDATE
- put: function(key, value){
- db.transaction(function(tx) {
- tx.executeSql("UPDATE " + dbTable + " SET value=?,timestamp=? WHERE key=? ",[value,now(),key],defaultDataHandle,defaultErrorHandle);
- });
- },
-
- exists: function(key,fnc){
- this.get(key,function(d){
- fnc((d == null) ? false : true);
- });
- },
-
- clear: function(){
- db.transaction(function(tx) {
- tx.executeSql("DELETE FROM " + dbTable ,[],defaultDataHandle,defaultErrorHandle);
- });
- }
- }
-}().setup();
Oops, something went wrong.

0 comments on commit 9036fb2

Please sign in to comment.