Adobe Integrated Runtime (AIR) for JavaScript Developers Pocket Reference

(nextflipdebug5) #1
Embedded Database | 119

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

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

function doStmtResult( event )
{
alert( "The database table has been created." );
}

function doStmtError( event )
{
alert( "There has been a problem executing a
statement:\n" + event.error.message );
}

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

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

</body>
</html>

Storing Data in a Database


Problem


An application needs to store user-provided data in a rela-
tional database on disk.


Solution


SQL92 INSERT statements can be created and executed
using theSQLStatement class.

Free download pdf