gpt4 book ai didi

android - SQLite 行限制

转载 作者:搜寻专家 更新时间:2023-10-30 23:16:52 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Limit an sqlite Table's Maximum Number of Rows

如何限制我的 sqlite 数据库中的行数?我想将我的数据库限制为 10 行,并在尝试超过该数字时给出一条消息。这是在创建数据库时还是在查询数据库时完成的

创作:

String sqlDataStore = "create table if not exists " 
+ TABLE_NAME_INFOTABLE + " ("+ BaseColumns._ID + " integer primary key autoincrement,"

+ COLUMN_NAME_SITE + "text not null,"
+ COLUMN_NAME_ADDRESS + "text not null,"
+ COLUMN_NAME_USERNAME + "text not null,"
+ COLUMN_NAME_PASSWORD + "text not null)";

db.execSQL(sqlDataStore);

查询:

 Cursor cursor = database.query(databaseName.TABLE_NAME, null, null, null, null, null, databaseName.COLUMN_NAME, null);

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