回到基础:为 Apache Derby 的 ij 工具编写脚本
2010-04-23 00:00:00 来源:WEB开发网但更有用的功能是创建可用于不同行和不同值的语句,如 清单 7 所示。
清单 7. 带有值的准备好的语句
ij(CONNECTION1)> prepare updateOneDeveloper as
'update developers set availability = ? where id = ?';
ij(CONNECTION1)> execute updateOneDeveloper using
'VALUES (''Im really serious here. Hire this guy!'', 4)';
1 row inserted/updated/deleted
ij(CONNECTION1)> commit;
ij(CONNECTION1)> select * from developers;
ID |DEVELOPER_NAME |AVAILABILITY
--------------------------------------------------------
1 |Jim Bacon |open
2 |Brady James |open
3 |Michelle Rappaport |open
4 |Aaron Templeton |Im really serious here. Hire this
guy!
4 rows selected
与 JDBC 应用程序中的准备好的语句一样,值可以按在语句中出现的顺序被各占位符取代。
您甚至可以创建与多个数据集一起使用的准备好的语句(参见 清单 8)。
清单 8. 带有多个值集的准备好的语句
ij(CONNECTION1)> prepare addDeveloper as
'insert into developers values (?, ?, ?)';
ij(CONNECTION1)> execute addDeveloper using
'VALUES (5, ''Corben Deeto'', ''Available this summer''),
(6, ''Seetha Pio'', ''Open'')';
1 row inserted/updated/deleted
1 row inserted/updated/deleted
ij(CONNECTION1)> select * from developers;
ID |DEVELOPER_NAME |AVAILABILITY
--------------------------------------------------------------------
1 |Jim Bacon |open
2 |Brady James |open
3 |Michelle Rappaport |open
4 |Aaron Templeton |Im really serious here. HIRE this
guy!
5 |Corben Deeto |Available this summer
6 |Seetha Pio |Open
6 rows selected
- ››apache设置域名绑定 以及绑定不起作用的排查
- ››apache rewrite将指定URL转向指定的几个服务器
- ››apache配置文件httpd.comf部分参数说明
- ››Apache+Mysql+PHP+phpMyAdmin+Mac OS X 10.7 Lion...
- ››apache+tomcat负载均衡_项目实例
- ››apache mysql php 源码编译使用
- ››Apache添加mod_aspdotnet.so支持ASP.NET配置指南
- ››Apache中改变php.ini的路径
- ››Apache2.2与Tomcat6整合及虚拟主机配置
- ››Apache+php+mysql在windows下的安装与配置图解
- ››基础推广如何完成网站的优化升级(一)
- ››Apache+Subversion完美结合,CentOS下实现版本控制...
更多精彩
赞助商链接