weed3-2.3.1.查询的输出有哪些
发表于:2025-12-01 作者:千家信息网编辑
千家信息网最后更新 2025年12月01日,本篇内容主要讲解"weed3-2.3.1.查询的输出有哪些",感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习"weed3-2.3.1.查询的输出有哪些"吧!We
千家信息网最后更新 2025年12月01日weed3-2.3.1.查询的输出有哪些
本篇内容主要讲解"weed3-2.3.1.查询的输出有哪些",感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习"weed3-2.3.1.查询的输出有哪些"吧!
Weed3 一个微型ORM框架(只有0.1Mb哦)
源码:https://github.com/noear/weed3 源码:https://gitee.com/noear/weed3
查询可是个复杂的话题了,可能我们80%的数据库处理都在查询。
今天先讲讲weed3的查询能输出什么?
1.1.快捷查询数量
db.table("user_info").where("user_id", 10).count();1.2.快捷查询是否存在
db.table("user_info").where("user_id", 10).exists();2.1.查询一行的一个字段,输出单值
bool val = db.table("user_info") .where("user_id=?", 10) .select("sex").getValue(false); //设个默认值为:false2.2.查询多行的一个字段,输出数组
Listary = db.table("user_info") .where("user_id=?", 10) .select("mobile").getArray("mobile");
3.1.查询一行,输出map
Mapmap = db.table("user_info") .where("user_id=?", 10) .select("*").getMap();
3.2.查询多行,输出map list
List
4.1.查询一行,输出entity
UserModel m = db.table("user_info") .where("user_id=?", 10) .select("*").getItem(UserModel.class); //用户模型(我统叫它模型)//这里写了最简单的格式,可以改为bean风格public class UserModel{ public String name; public String mobile; public int sex;}4.2.查询多行,输出entity list
Listlist = db.table("user_info") .where("user_id>?", 10).limit(0,20) //分页取20行 .select("*").getList(UserModel.class);
那还能再输出什么?
1.select("...") 返回的是一个:IQuery
public interface IQuery extends ICacheController{ long getCount() throws SQLException; Object getValue() throws SQLException; T getValue(T def) throws SQLException; Variate getVariate() throws SQLException; Variate getVariate(Act2 cacheCondition) throws SQLException; T getItem(T model) throws SQLException; T getItem(T model, Act2 cacheCondition) throws SQLException; List getList(T model) throws SQLException; List getList(T model, Act2 > cacheCondition) throws SQLException; T getItem(Class cls) throws SQLException; T getItem(Class cls,Act2 cacheCondition) throws SQLException; List getList(Class cls) throws SQLException; List getList(Class cls,Act2 > cacheCondition) throws SQLException; DataList getDataList() throws SQLException; DataList getDataList(Act2 cacheCondition) throws SQLException; DataItem getDataItem() throws SQLException; DataItem getDataItem(Act2 cacheCondition) throws SQLException; List
2.其中 getDataList() 返加的是 DataList,它有一些类型转换接口:
/** 将所有列转为类做为数组的数据(类为:IBinder 子类) */ListtoList(T model);/** 将所有列转为类做为数组的数据 */List toEntityList(Class cls);/** 选1列做为MAP的key,并把行数据做为val */Map toMap(String keyColumn);/** 选两列做为MAP的数据 */Map toMap(String keyColumn,String valColumn);/** 选一列做为SET的数据 */Set toSet(String column)/** 选一列做为数组的数据 */List toArray(String columnName)/** 选一列做为数组的数据 */List toArray(int columnIndex)/** 转为json字符串 */String toJson();
其中 getVariate() 返回的是 Variate,也提供了些转换接口
T value(T def);double doubleValue(double def);long longValue(long def);int intValue(int def);String stringValue(String def);
到此,相信大家对"weed3-2.3.1.查询的输出有哪些"有了更深的了解,不妨来实际操作一番吧!这里是网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
查询
输出
数据
数组
一行
多行
内容
字段
接口
模型
源码
学习
复杂
实用
更深
兴趣
只有
子类
字符
字符串
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
合阳县崇雨网络技术有限公司
重庆苹果软件开发收费多少
西集网络安全产业联盟
昆明 软件开发 培训
plus数据库连接
网络安全备案委托书怎么写
数据库管理系统并发控制技术
服务器var日志怎么看
上海数据库空投箱销售价格
脏小豆服务器生存骗赞
蓝牙设备怎么连接终端数据库
网络安全法民众反应
网络安全理论doc
国家网络安全测试中心
数据库 安全性 架构
海康服务器上墙设置
果洛软件开发五星服务
云隙服务器ip
互联网科技公司起什么名字好
浙江信创云服务器
云服务器创建购买费用
热门应用软件开发 90年代
软件开发规范 正式版
医生增强网络安全保密意识
炎陵软件开发技工学校
数据库中各字段间用什么来间隔
深度操作系统上的软件开发
数据库技术主要有
两个电脑如何搭建git服务器
查找数据库表空间路径