【从API学英语】-PreparedStatement
2024-08-23 00:06:33
原文
An object that represents a precompiled SQL statement.
A SQL statement is precompiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement multiple times. Note: The setter methods (setShort, setString, and so on) for setting IN parameter values must specify types that are compatible with the defined SQL type of the input parameter. For instance, if the IN parameter has SQL type INTEGER, then the method setInt should be used. If arbitrary parameter type conversions are required, the method setObject should be used with a target SQL type. In the following example of setting a parameter, con represents an active connection: PreparedStatement pstmt = con.prepareStatement("UPDATE EMPLOYEES
SET SALARY = ? WHERE ID = ?");
pstmt.setBigDecimal(1, 153833.00)
pstmt.setInt(2, 110592)
翻译
一个对象(它代表一个预编译的sql statement) 一个sql Statement是预编译的,存储在一个PreparedStatement对象。
这个对象可以常常高效的多次执行这个statement。 备注:设置方法(setShort,setString,等等)用来设置IN参数值时必须指定类型(这个类型兼容被定义的输入参数的sql类型)。
例如,如果IN参数有SQL类型INTEGER,那么setInt方法就应该被使用。 如果需要任意参数类型转换,应该使用setObject()方法指定sql类型。 在下面的例子中,设置一个参数,con代表一个活动的连接
最新文章
- ABP理论学习之领域服务
- sqlserver 连接远程数据库小结
- Manacher
- (1)as_view() (2)在urls.py里面出现的pk是怎么回事 (3)RetrieveAPIView表示什么
- nginx 反向代理 与 Apache backend的配置联合配置
- Python webpy微信公众号开发之 回复图文消息
- linux搭建java环境
- Fragment回调接口应用间分享数据
- Python协程深入理解
- 智能合约语言 Solidity 教程系列2 - 地址类型介绍
- Windows10系统:任务栏中电池图标消失问题的解决方法
- SQLAlchemy使用(三)搭配Flask框架使用
- 继续mysql8navicat12连接登录的异常
- 利用Linux系统生成随机密码的10种方法【转】
- ELK基础原理
- Scrapy学习篇(十三)之scrapy+selenum获取网站cookie并保存带本地
- python scrapy爬取知乎问题和收藏夹下所有答案的内容和图片
- tftp 传输文件
- How to Sign in as a Different User in SharePoint 2013
- JAVAEE——淘淘商城第一天:电商行业的背景和技术特点,商城的介绍、技术的选型、系统架构和工程搭建