Skip to content
Menu
(◍ ´꒳` ◍)

  • Blog
  • Front Page
(◍ ´꒳` ◍)

鸿蒙55数据库query

By admin on 2021年10月12日2021年10月12日

query() 该方法接收三个参数,分别是查询的目标路径,查询的列名,以及查询条件,查询条件由 类 DataAbilityPredicates 构建。根据传入的列名和查询条件查询用户表的代码示例如下:

public ResultSet 结果集的数据表query(Uri uri, String[] columns柱, DataAbilityPredicates predicates谓词函数) {

#Columns是一个函数,可以用来设置或检索对象的列数和每列的宽度。定义了Predicate接口,该接口包含一个带有泛型参数的方法
if (ormContext对象关系映射 数据库== null) {
HiLog.error(LABEL_LOG, “failed to query, ormContext is null”);
return null;
}
// 查询数据库
OrmPredicates ormPredicates = DataAbilityUtils.createOrmPredicates(predicates,User.class);
ResultSet resultSet = ormContext.query(ormPredicates, columns);
if (resultSet == null) {
HiLog.info(LABEL标签_LOG, “resultSet is null”);

}
// 返回结果
return resultSet;
}

Category: 鸿蒙

文章导航

paper周杰伦翻译20
鸿蒙56insert()

Related Posts

鸿蒙62Data 声明访问需要权限

11月 3, 2021
Read More

鸿蒙54编写数据库操作方法01

10月 11, 2021
Read More

承认平庸-iptables部署-02

3月 2, 2023
Read More

发表回复 取消回复

您的电子邮箱地址不会被公开。 必填项已用*标注

近期文章

  • 实施002
  • 实施SQL001
  • 泛微oa001-字段
  • 硬件前端-海康威视摄像头
  • 使用Docker搭建Weblogic服务001

近期评论

    归档

    • 2023年10月
    • 2023年9月
    • 2023年8月
    • 2023年5月
    • 2023年4月
    • 2023年3月
    • 2021年11月
    • 2021年10月
    • 2021年9月
    • 2021年8月
    • 2021年5月

    分类

    • C
    • docker
    • iptable
    • ISIS
    • java
    • k8s
    • liunx
    • OpenCV py
    • ospf
    • solr
    • zabbix
    • 劳动法
    • 周杰伦
    • 格林法则
    • 等保
    • 鸿蒙

    其他操作

    • 登录
    • 条目feed
    • 评论feed
    • WordPress.org
    ©2025 (◍ ´꒳` ◍) | WordPress Theme by Superb WordPress Themes