incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject [32/32] Add English version 1.2.0
Date Fri, 20 Jan 2012 19:56:04 GMT
http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/a5a19ef2/docs/en/1.2.0/phonegap/storage/sqlresultset/sqlresultset.md
----------------------------------------------------------------------
diff --git a/docs/en/1.2.0/phonegap/storage/sqlresultset/sqlresultset.md b/docs/en/1.2.0/phonegap/storage/sqlresultset/sqlresultset.md
new file mode 100644
index 0000000..bdc70b7
--- /dev/null
+++ b/docs/en/1.2.0/phonegap/storage/sqlresultset/sqlresultset.md
@@ -0,0 +1,115 @@
+SQLResultSet
+=======
+
+When the executeSql method of a SQLTransaction is called it will invoke it's callback with
a SQLResultSet.
+
+Properties
+-------
+
+- __insertId__: the row ID of the row that the SQLResultSet object's SQL statement inserted
into the database
+- __rowAffected__: the number of rows that were changed by the SQL statement.  If the statement
did not affect any rows then it is set to 0. 
+- __rows__: a SQLResultSetRowList representing the rows returned.  If no rows are returned
the object will be empty.
+
+Details
+-------
+
+When you call the SQLTransaction executeSql method it's callback methods will be called with
a SQLResultSet object.  The result object has three properties.  The first is the `insertId`
which will return the row number of a success SQL insert statement.  If the SQL statement
is not an insert then the `insertId` is not set.  The `rowAffected` is always 0 for a SQL
select statement.  For insert or update statements it returns the number of rows that have
been modified.  The final property is of type SQLResultSetList and it contains the data returned
from a SQL select statement.
+
+Supported Platforms
+-------------------
+
+- Android
+- BlackBerry WebWorks (OS 6.0 and higher)
+- iPhone
+
+Execute SQL Quick Example
+------------------
+
+	function queryDB(tx) {
+		tx.executeSql('SELECT * FROM DEMO', [], querySuccess, errorCB);
+	}
+
+	function querySuccess(tx, results) {
+		// this will be empty since no rows were inserted.
+		console.log("Insert ID = " + results.insertId);
+		// this will be 0 since it is a select statement
+		console.log("Rows Affected = " + results.rowAffected);
+		// the number of rows returned by the select statement
+		console.log("Insert ID = " + results.rows.length);
+	}
+	
+	function errorCB(err) {
+		alert("Error processing SQL: "+err.code);
+	}
+	
+	var db = window.openDatabase("Database", "1.0", "PhoneGap Demo", 200000);
+	db.transaction(queryDB, errorCB);
+
+Full Example
+------------
+
+    <!DOCTYPE html>
+    <html>
+      <head>
+        <title>Contact Example</title>
+
+        <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
+        <script type="text/javascript" charset="utf-8">
+
+        // Wait for PhoneGap to load
+        //
+        document.addEventListener("deviceready", onDeviceReady, false);
+
+		// Populate the database 
+		//
+		function populateDB(tx) {
+			tx.executeSql('DROP TABLE IF EXISTS DEMO');
+			tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (id unique, data)');
+			tx.executeSql('INSERT INTO DEMO (id, data) VALUES (1, "First row")');
+			tx.executeSql('INSERT INTO DEMO (id, data) VALUES (2, "Second row")');
+		}
+
+		// Query the database
+		//
+		function queryDB(tx) {
+			tx.executeSql('SELECT * FROM DEMO', [], querySuccess, errorCB);
+		}
+
+		// Query the success callback
+		//
+		function querySuccess(tx, results) {
+			// this will be empty since no rows were inserted.
+			console.log("Insert ID = " + results.insertId);
+			// this will be 0 since it is a select statement
+			console.log("Rows Affected = " + results.rowAffected);
+			// the number of rows returned by the select statement
+			console.log("Insert ID = " + results.rows.length);
+		}
+
+		// Transaction error callback
+		//
+		function errorCB(err) {
+			console.log("Error processing SQL: "+err.code);
+		}
+
+		// Transaction success callback
+		//
+		function successCB() {
+			var db = window.openDatabase("Database", "1.0", "PhoneGap Demo", 200000);
+			db.transaction(queryDB, errorCB);
+		}
+
+		// PhoneGap is ready
+		//
+		function onDeviceReady() {
+			var db = window.openDatabase("Database", "1.0", "PhoneGap Demo", 200000);
+			db.transaction(populateDB, errorCB, successCB);
+		}
+	
+        </script>
+      </head>
+      <body>
+        <h1>Example</h1>
+        <p>Database</p>
+      </body>
+    </html>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/a5a19ef2/docs/en/1.2.0/phonegap/storage/sqlresultsetlist/sqlresultsetlist.md
----------------------------------------------------------------------
diff --git a/docs/en/1.2.0/phonegap/storage/sqlresultsetlist/sqlresultsetlist.md b/docs/en/1.2.0/phonegap/storage/sqlresultsetlist/sqlresultsetlist.md
new file mode 100644
index 0000000..cff4faa
--- /dev/null
+++ b/docs/en/1.2.0/phonegap/storage/sqlresultsetlist/sqlresultsetlist.md
@@ -0,0 +1,116 @@
+SQLResultSetList
+=======
+
+One of the properties of the SQLResultSet containing the rows returned from a SQL query.
+
+Properties
+-------
+
+- __length__: the number of rows returned by the SQL query
+
+Methods
+-------
+
+- __item__: returns the row at the specified index represented by a JavaScript object.
+
+Details
+-------
+
+The SQLResultSetList contains the data returned from a SQL select statement.  The object
contains a length property letting you know how many rows the select statement has been returned.
 To get a row of data you would call the `item` method specifing an index.  The item method
returns a JavaScript Object who's properties are the columns of the database the select statement
was executed against.
+
+Supported Platforms
+-------------------
+
+- Android
+- BlackBerry WebWorks (OS 6.0 and higher)
+- iPhone
+
+Execute SQL Quick Example
+------------------
+
+	function queryDB(tx) {
+		tx.executeSql('SELECT * FROM DEMO', [], querySuccess, errorCB);
+	}
+
+	function querySuccess(tx, results) {
+		var len = results.rows.length;
+	���	console.log("DEMO table: " + len + " rows found.");
+	���	for (var i=0; i<len; i++){
+	����	console.log("Row = " + i + " ID = " + results.rows.item(i).id + " Data =  "
+ results.rows.item(i).data);
+		}
+	}
+	
+	function errorCB(err) {
+		alert("Error processing SQL: "+err.code);
+	}
+	
+	var db = window.openDatabase("Database", "1.0", "PhoneGap Demo", 200000);
+	db.transaction(queryDB, errorCB);
+
+Full Example
+------------
+
+    <!DOCTYPE html>
+    <html>
+      <head>
+        <title>Contact Example</title>
+
+        <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
+        <script type="text/javascript" charset="utf-8">
+
+        // Wait for PhoneGap to load
+        //
+        document.addEventListener("deviceready", onDeviceReady, false);
+
+		// Populate the database 
+		//
+		function populateDB(tx) {
+			tx.executeSql('DROP TABLE IF EXISTS DEMO');
+			tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (id unique, data)');
+			tx.executeSql('INSERT INTO DEMO (id, data) VALUES (1, "First row")');
+			tx.executeSql('INSERT INTO DEMO (id, data) VALUES (2, "Second row")');
+		}
+
+		// Query the database
+		//
+		function queryDB(tx) {
+			tx.executeSql('SELECT * FROM DEMO', [], querySuccess, errorCB);
+		}
+
+		// Query the success callback
+		//
+		function querySuccess(tx, results) {
+			var len = results.rows.length;
+			console.log("DEMO table: " + len + " rows found.");
+			for (var i=0; i<len; i++){
+				console.log("Row = " + i + " ID = " + results.rows.item(i).id + " Data =  " + results.rows.item(i).data);
+			}
+		}
+
+		// Transaction error callback
+		//
+		function errorCB(err) {
+			console.log("Error processing SQL: "+err.code);
+		}
+
+		// Transaction success callback
+		//
+		function successCB() {
+			var db = window.openDatabase("Database", "1.0", "PhoneGap Demo", 200000);
+			db.transaction(queryDB, errorCB);
+		}
+
+		// PhoneGap is ready
+		//
+		function onDeviceReady() {
+			var db = window.openDatabase("Database", "1.0", "PhoneGap Demo", 200000);
+			db.transaction(populateDB, errorCB, successCB);
+		}
+	
+        </script>
+      </head>
+      <body>
+        <h1>Example</h1>
+        <p>Database</p>
+      </body>
+    </html>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/a5a19ef2/docs/en/1.2.0/phonegap/storage/sqltransaction/sqltransaction.md
----------------------------------------------------------------------
diff --git a/docs/en/1.2.0/phonegap/storage/sqltransaction/sqltransaction.md b/docs/en/1.2.0/phonegap/storage/sqltransaction/sqltransaction.md
new file mode 100644
index 0000000..07403dc
--- /dev/null
+++ b/docs/en/1.2.0/phonegap/storage/sqltransaction/sqltransaction.md
@@ -0,0 +1,93 @@
+SQLTransaction
+=======
+
+Contains methods that allow the user to execute SQL statements against the Database.
+
+Methods
+-------
+
+- __executeSql__: executes a SQL statement
+
+Details
+-------
+
+When you call a Database objects transaction method it's callback methods will be called
with a SQLTransaction object.  The user can build up a database transaction by calling the
executeSql method multiple times.  
+
+Supported Platforms
+-------------------
+
+- Android
+- BlackBerry WebWorks (OS 6.0 and higher)
+- iPhone
+
+Execute SQL Quick Example
+------------------
+
+	function populateDB(tx) {
+		 tx.executeSql('DROP TABLE IF EXISTS DEMO');
+		 tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (id unique, data)');
+		 tx.executeSql('INSERT INTO DEMO (id, data) VALUES (1, "First row")');
+		 tx.executeSql('INSERT INTO DEMO (id, data) VALUES (2, "Second row")');
+	}
+	
+	function errorCB(err) {
+		alert("Error processing SQL: "+err);
+	}
+	
+	function successCB() {
+		alert("success!");
+	}
+	
+	var db = window.openDatabase("Database", "1.0", "PhoneGap Demo", 200000);
+	db.transaction(populateDB, errorCB, successCB);
+
+Full Example
+------------
+
+    <!DOCTYPE html>
+    <html>
+      <head>
+        <title>Contact Example</title>
+
+        <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
+        <script type="text/javascript" charset="utf-8">
+
+        // Wait for PhoneGap to load
+        //
+        document.addEventListener("deviceready", onDeviceReady, false);
+
+        // PhoneGap is ready
+        //
+        function onDeviceReady() {
+			var db = window.openDatabase("Database", "1.0", "PhoneGap Demo", 200000);
+			db.transaction(populateDB, errorCB, successCB);
+        }
+		
+		// Populate the database 
+		//
+		function populateDB(tx) {
+			 tx.executeSql('DROP TABLE IF EXISTS DEMO');
+			 tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (id unique, data)');
+			 tx.executeSql('INSERT INTO DEMO (id, data) VALUES (1, "First row")');
+			 tx.executeSql('INSERT INTO DEMO (id, data) VALUES (2, "Second row")');
+		}
+		
+		// Transaction error callback
+		//
+		function errorCB(err) {
+			alert("Error processing SQL: "+err);
+		}
+		
+		// Transaction success callback
+		//
+		function successCB() {
+			alert("success!");
+		}
+	
+        </script>
+      </head>
+      <body>
+        <h1>Example</h1>
+        <p>SQLTransaction</p>
+      </body>
+    </html>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/a5a19ef2/docs/en/1.2.0/phonegap/storage/storage.md
----------------------------------------------------------------------
diff --git a/docs/en/1.2.0/phonegap/storage/storage.md b/docs/en/1.2.0/phonegap/storage/storage.md
new file mode 100644
index 0000000..cc24a79
--- /dev/null
+++ b/docs/en/1.2.0/phonegap/storage/storage.md
@@ -0,0 +1,29 @@
+Storage
+==========
+
+> Provides access to the devices storage options.  
+
+This API is based on the [W3C Web SQL Database Specification](http://dev.w3.org/html5/webdatabase/)
and [W3C Web Storage API Specification](http://dev.w3.org/html5/webstorage/). Some devices
already provide an implementation of this spec. For those devices, the built-in support is
used instead of replacing it with PhoneGap's implementation. For devices that don't have storage
support, PhoneGap's implementation should be compatible with the W3C specification.
+
+Methods
+-------
+
+- openDatabase
+
+Arguments
+---------
+
+- name
+- version
+- display_name
+- size
+
+Objects
+-------
+
+- Database
+- SQLTransaction
+- SQLResultSet
+- SQLResultSetList
+- SQLError
+- localStorage
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/a5a19ef2/docs/en/1.2.0/phonegap/storage/storage.opendatabase.md
----------------------------------------------------------------------
diff --git a/docs/en/1.2.0/phonegap/storage/storage.opendatabase.md b/docs/en/1.2.0/phonegap/storage/storage.opendatabase.md
new file mode 100644
index 0000000..fa63748
--- /dev/null
+++ b/docs/en/1.2.0/phonegap/storage/storage.opendatabase.md
@@ -0,0 +1,54 @@
+openDatabase
+===============
+
+Returns a new Database object.
+
+    var dbShell = window.openDatabase(name, version, display_name, size);
+
+Description
+-----------
+
+window.openDatabase returns a new Database object.
+
+This method will create a new SQL Lite Database and return a Database object.  Use the Database
Object to manipulate the data.
+
+Supported Platforms
+-------------------
+
+- Android
+- BlackBerry WebWorks (OS 6.0 and higher)
+- iPhone
+
+Quick Example
+-------------
+
+    var db = window.openDatabase("test", "1.0", "Test DB", 1000000);
+
+Full Example
+------------
+
+    <!DOCTYPE html>
+    <html>
+      <head>
+        <title>Contact Example</title>
+
+        <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
+        <script type="text/javascript" charset="utf-8">
+
+        // Wait for PhoneGap to load
+        //
+        document.addEventListener("deviceready", onDeviceReady, false);
+
+        // PhoneGap is ready
+        //
+        function onDeviceReady() {
+			var db = window.openDatabase("test", "1.0", "Test DB", 1000000);
+        }
+		
+        </script>
+      </head>
+      <body>
+        <h1>Example</h1>
+        <p>Open Database</p>
+      </body>
+    </html>


Mime
View raw message