Actionscript-3和android-sqlite问题

问题描述 投票:0回答:1

我在使用此方法时遇到问题:createTable.execute()!!!!!我在Windows的空气中没有问题,但在android的空气中没有出现任何anny错误,但游戏在第1帧停止了。导入flash.data.SQLConnection;导入flash.events.SQLErrorEvent;导入flash.events.SQLEvent;导入flash.filesystem.File;导入flash.data.SQLStatement;导入flash.data.SQLMode;导入flash.data.SQLResult;导入flash.errors.SQLError;

var conn: SQLConnection = new SQLConnection();

conn.addEventListener(SQLEvent.OPEN, openHandler);
conn.addEventListener(SQLErrorEvent.ERROR, errorHandler);
// The database file is in the application storage directory
var folder: File = File.applicationStorageDirectory;
var dbFile: File = folder.resolvePath("DBSave1.db");
//conn.openAsync(dbFile);
conn.openAsync(dbFile);

function openHandler(event: SQLEvent): void {
    trace("#############the database was created successfully#############");
}
function errorHandler(event: SQLErrorEvent): void {
    trace("#############Error message############# :", event.error.message);
    trace("#############Details err############# :", event.error.details);
}

trace("+++++++++++++++++++++++++++++++");
var createTable: SQLStatement = new SQLStatement();
createTable.sqlConnection = conn;

var table: String = "CREATE TABLE IF NOT EXISTS savegame (" + "uId INTEGER PRIMARY KEY AUTOINCREMENT, " + "firstParam TEXT, " + "secondParam TEXT, " + "thirdParam TEXT " + ")";

createTable.text = table;

try {
    createTable.execute();
    trace("Table created");
} catch (error: SQLError) {
    trace("Error message:", error.message);
    trace("Details:", error.details);
}
actionscript-3 android-sqlite
1个回答
0
投票

我必须在openHandler()中放置另一个函数。首先,我们应该打开数据库,并在其功能中执行与数据库有关的另一项操作。

© www.soinside.com 2019 - 2024. All rights reserved.