我正在尝试解决为什么我的代码对所有查询都返回 null 的原因,最后发现 sql 查询什么都不返回.我用简约的代码创建了一个新的 AIR 文档 (s:WindowedApplication):
I am trying to troubleshoot why my code returned null for all my queries and finally found that sql query returns nothing. I created a new AIR document (s:WindowedApplication) with minimalistic code:
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
private var sqlConnection:SQLConnection;
private var select:SQLStatement;
private var databaseFile:File;
protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void
{
var dbPath:String = "Movie Manager Settings/moovioDB2.db";
databaseFile = File.userDirectory.resolvePath(dbPath);
sqlConnection = new SQLConnection();
select = new SQLStatement();
sqlConnection.addEventListener(SQLEvent.OPEN, onDatabaseOpen);
sqlConnection.openAsync();
}
private function onDatabaseOpen(event:SQLEvent):void
{
select.sqlConnection = sqlConnection;
var query:String = "SELECT title FROM movies";
select.text = query;
select.addEventListener(SQLEvent.RESULT, done);
select.execute();
}
private function done(event:SQLEvent):void{
var res:SQLResult = select.getResult();
}
]]>
</fx:Script>
除此代码外,只有 Flex 创建的标准标签.执行后,我收到此错误:
Other than this code theres is just the standard tags created by Flex. Upon execution I get this error:
Error #2044: Unhandled SQLErrorEvent:. errorID=3115, operation=execute , message=Error #3115: SQL Error. , details=no such table: 'movies'
我已经用 2 个不同的 sqlite 程序检查了数据库文件并成功执行了查询.电影"表和标题"列都存在.如果重要,电影是 3 个表之一,并且有超过 10 个列都存在值.
I have checked the database file with 2 different sqlite programs and executed the query successfully. Both 'movies' table and 'title' column exists. In case it matters movies is one of 3 tables and has over 10 columns all with values present.
我做错了什么?我之前使用了相同的代码(我认为)并获得了预期的结果,但现在经过一些更改后,我什至可以在新文档中使用此基本代码.请检查一下,看看我是否犯了一个愚蠢的错误,因为我看不到它:)
What am I doing wrong? I used identical code(I thought) before with expected results, but after some changes now I can even get this basic code in a new document to work. Please check it out and see if I am making a stupid mistake because I can't see it :)
你能验证你打开的数据库的路径是你用外部工具检查过的那个文件吗?您可以在 AS3 代码中使用 database_list pragma.就像执行任何其他 SQL 语句一样执行它:
Can you verify that the path of the database you open is the one of that file you checked with external tools? You can use the database_list pragma from within you AS3 code. Just execute it as any other SQL statement:
[user@host ~]$ cd /tmp
[user@host tmp]$ sqlite3 foo.db
SQLite version 3.7.11 2012-03-20 11:35:50
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> pragma database_list;
0|main|/tmp/foo.db
这篇关于SQL 错误:“没有这样的表"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
如何有效地使用窗口函数根据 N 个先前值来决定How to use windowing functions efficiently to decide next N number of rows based on N number of previous values(如何有效地使用窗口函数根据
在“GROUP BY"中重用选择表达式的结果;条款reuse the result of a select expression in the quot;GROUP BYquot; clause?(在“GROUP BY中重用选择表达式的结果;条款?)
Pyspark DataFrameWriter jdbc 函数的 ignore 选项是忽略整Does ignore option of Pyspark DataFrameWriter jdbc function ignore entire transaction or just offending rows?(Pyspark DataFrameWriter jdbc 函数的 ig
使用 INSERT INTO table ON DUPLICATE KEY 时出错,使用 Error while using INSERT INTO table ON DUPLICATE KEY, using a for loop array(使用 INSERT INTO table ON DUPLICATE KEY 时出错,使用 for 循环数组
pyspark mysql jdbc load 调用 o23.load 时发生错误 没有合pyspark mysql jdbc load An error occurred while calling o23.load No suitable driver(pyspark mysql jdbc load 调用 o23.load 时发生错误 没有合适的
如何将 Apache Spark 与 MySQL 集成以将数据库表作为How to integrate Apache Spark with MySQL for reading database tables as a spark dataframe?(如何将 Apache Spark 与 MySQL 集成以将数据库表作为