gpt4 book ai didi

android - 需要列约束或逗号,得到文本

转载 作者:太空宇宙 更新时间:2023-11-03 13:07:29 27 4
gpt4 key购买 nike

我非常有信心我已经正确地格式化了它,因为它基本上是我正在使用的另一个语句的精确副本(它工作正常),但我收到一个错误说明

'(', ')' <column constraint> or comma expected, got 'TEXT'

和行中“TEXT”下的红色下划线:

+ RecentFileWaypointContract.Columns.RECENT_FILE_WAYPOINT_CONTROL_NUMBER + " TEXT NOT NULL, "

就像我说的,我在其他地方基本上得到了与此声明完全相同的副本。

这是行不通的:

String sSQL;
sSQL = "CREATE TABLE " + RecentFileWaypointContract.TABLE_NAME + " ("
+ RecentFileWaypointContract.Columns._ID + " INTEGER PRIMARY KEY NOT NULL, "
+ RecentFileWaypointContract.Columns.RECENT_FILE_WAYPOINT_CONTROL_NUMBER + " TEXT NOT NULL, "
+ RecentFileWaypointContract.Columns.RECENT_FILE_WAYPOINT_INSURED_NAME + " TEXT NOT NULL, "
+ RecentFileWaypointContract.Columns.RECENT_FILE_WAYPOINT_CUSTOMER + " TEXT NOT NULL, "
+ RecentFileWaypointContract.Columns.RECENT_FILE_WAYPOINT_ADDRESS1 + " TEXT NOT NULL, "
+ RecentFileWaypointContract.Columns.RECENT_FILE_WAYPOINT_ADDRESS2 + " TEXT, "
+ RecentFileWaypointContract.Columns.RECENT_FILE_WAYPOINT_CITY + " TEXT NOT NULL, "
+ RecentFileWaypointContract.Columns.RECENT_FILE_WAYPOINT_STATE + " TEXT NOT NULL, "
+ RecentFileWaypointContract.Columns.RECENT_FILE_WAYPOINT_ZIPCODE + " TEXT NOT NULL);";
db.execSQL(sSQL);

为了比较,这里是工作正常的那个:

String sSQL;
sSQL = "CREATE TABLE " + UserWaypointContract.TABLE_NAME + " ("
+ UserWaypointContract.Columns._ID + " INTEGER PRIMARY KEY NOT NULL, "
+ UserWaypointContract.Columns.USER_WAYPOINT_TITLE + " TEXT NOT NULL, "
+ UserWaypointContract.Columns.USER_WAYPOINT_ADDRESS1 + " TEXT NOT NULL, "
+ UserWaypointContract.Columns.USER_WAYPOINT_ADDRESS2 + " TEXT, "
+ UserWaypointContract.Columns.USER_WAYPOINT_CITY + " TEXT NOT NULL, "
+ UserWaypointContract.Columns.USER_WAYPOINT_STATE + " TEXT NOT NULL, "
+ UserWaypointContract.Columns.USER_WAYPOINT_ZIPCODE + " TEXT NOT NULL);";

db.execSQL(sSQL);

(此外,有两个不同的类,所以在两个地方使用 sSQL 不是问题)

有什么想法吗?

最佳答案

列名中不能有空格。将 "Control number" 替换为 "Control_number""ControlNumber""controlNumber" 或类似内容。

关于android - 需要列约束或逗号,得到文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56447728/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com