Adobe Integrated Runtime (AIR) for JavaScript Developers Pocket Reference

(nextflipdebug5) #1

116 | Chapter 4: AIR Mini-Cookbook


{
alert( "You are now connected to the database." );
}

function doLoad()
{
var file =
air.File.applicationResourceDirectory.resolve( "crm.db" );

db.addEventListener( air.SQLEvent.OPEN, doDbOpen );
db.open( file, true );
}

function doUnload()
{
db.close();
}
</script>

</head>
<body onload="doLoad();" onunload="doUnload()">

</body>
</html>

Creating Database Tables


Problem


An application has a specific schema it needs to provide for
data storage.


Solution


Database schema can be created using theSQLStatementclass
using SQL92.


Discussion


Once a database file has been created and a connection to
the database has been established, the next likely step will be
to create any required schema. This can be accomplished
using SQL92 in conjunction with theSQLStatementclass. The

Free download pdf