只有第一个表CREATE TABLE语句中被创建 [英] Only first table in create table statement being created

查看:202
本文介绍了只有第一个表CREATE TABLE语句中被创建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

表资格证书并出现在亚行的shell。我检查了logcat的,它似乎并没有报告问题...

The table "credentials" does show up in the adb shell. I've checked logcat and it doesn't seem to report a problem...

   private static final String DATABASE_CREATE =
        "create table credentials (_id integer primary key autoincrement, "
                + "username text not null, password text not null, "
                + "lastupdate text);"
      + "create table user (_id integer primary key autoincrement, "
                + "firstname text not null, "
                + "lastname text not null);"
      + "create table phone (_phoneid integer primary key autoincrement, "
                + "userid integer not null, phonetype text not null, "
                + "phonenumber text not null);"
      + "create table email (_emailid integer primary key autoincrement, "
                + "userid integer not null, emailtype text not null, "
                + "emailaddress text not null);"
      + "create table address (_addressid integer primary key autoincrement,"
                + "userid integer not null, addresstype text not null, "
                + "address text not null);"
      + "create table instantmessaging (_imid integer primary key autoincrement, "
                + "userid integer not null, imtype text not null, "
                + "imaccount text not null);";

我已经浇过这一点,我敢打赌,它的一些愚蠢的语法拼写错误!或者,至少我希望这是一些小事; - )

I've been pouring over this and I bet its some silly syntax typo! Or, at least I hope it is something trivial ;-)

推荐答案

我想,您使用的是:

yourDB.execSQL("your statement");

如果是这样,谷歌文档提到了这一点:

If so, the google documentation mentions this :

执行一个SQL语句是   不是一个查询。例如,创建   TABLE,DELETE,INSERT等多   相隔声明; S不   支持。它需要一个写锁

Execute a single SQL statement that is not a query. For example, CREATE TABLE, DELETE, INSERT, etc. Multiple statements separated by ;s are not supported. it takes a write lock

所以,你必须每个分段create table语句并重复查询每个表。

So you have to fragment each create table statement and repeat the query for each table.

这篇关于只有第一个表CREATE TABLE语句中被创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆