回到基础:为 Apache Derby 的 ij 工具编写脚本
2010-04-23 00:00:00 来源:WEB开发网结合使用准备好的语句和游标
或许最有用的准备好的语句不仅可以获取输入值,而且还可以对游标的当前行进行操作。例如,您可以创建仅影响当前开发人员的语句(参见 清单 9)。
清单 9. 带有可更新型游标的准备好的语句
ij(CONNECTION1)> get cursor updateDevelopers as
'select * from developers for update';
ij(CONNECTION1)> prepare busyDeveloper as
'update developers set availability = ''Busy''
where current of updateDevelopers';
ij(CONNECTION1)> next updateDevelopers;
ID |DEVELOPER_NAME |AVAILABILITY
--------------------------------------------------------
1 |Jim Bacon |open
ij(CONNECTION1)> next updateDevelopers;
ID |DEVELOPER_NAME |AVAILABILITY
--------------------------------------------------------
2 |Brady James |open
ij(CONNECTION1)> execute busyDeveloper;
1 row inserted/updated/deleted
ij(CONNECTION1)> next updateDevelopers;
ID |DEVELOPER_NAME |AVAILABILITY
--------------------------------------------------------
3 |Michelle Rappaport |open
ij(CONNECTION1)> next updateDevelopers;
ID |DEVELOPER_NAME |AVAILABILITY
--------------------------------------------------------
4 |Aaron Templeton |Im really serious here. HIRE
this guy!
ij(CONNECTION1)> execute busyDeveloper;
1 row inserted/updated/deleted
ij(CONNECTION1)> select * from developers;
ID |DEVELOPER_NAME |AVAILABILITY
--------------------------------------------------------
1 |Jim Bacon |open
2 |Brady James |Busy
3 |Michelle Rappaport |open
4 |Aaron Templeton |Busy
5 |Corben Deeto |Available this summer
6 |Seetha Pio |Open
6 rows selected
ij(CONNECTION1)>
- ››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下实现版本控制...
更多精彩
赞助商链接