Browsing all articles from
八月, 2009
分享大二时候做的一套模板.
最初这个网站还开了一段时间.但是后来一直没管..现在都停了..
刚才整理电脑发现了..整理出来给大家看看..
那时候做的很幼稚..大家不要笑我..哈!!
由于全部是PNG做的..所以在IE6下严重走样:(
演示:
Punny 1.0 Standard 正式发布…
这次的版本修改是巨大的..很多人也跟我发过邮件.想必大家都等久了..
为了不让大家失望..这次我经过了很多的测试才放出来..同时将文档也重新写了一下..
可以说..这是一个全新的Punny..
至于到底变化有多大..大家去下下来源码..读一读文档就知道了:)..
直接给个传送门吧..那里什么都有了..
有问题给我发邮件:)
Oracle简单的带游标的存储过程操作类..
上个帖子发了一个例子..后来为了自己操作方面..封装成了类…只是为了自己方便..所以也共享出来吧..
如果你再改一下..完善一下..充分可以当做一个Oracle操作类的.
- <?php
- /**
- * Punny - The most easy-to-use PHP MVC framework
- * http://punny.skiyo.cn/
- *
- * Copyright (c) 2009 Jessica(董立强)
- * Licensed under the GPL licenses.
- *
- * @author Jessica<cndingo@qq.com>
- * @version $Id$
- */
- class Oracle {
- /**
- *
- * @var <resource> 数据库链接
- */
- private $connect;
- /**
- *
- * @var <resource> SQL语句标识
- */
- private $stmt;
- /**
- * 链接数据库
- *
- * @param <string> $tns
- * @param <string> $user
- * @param <string> $pwd
- */
- public function __construct($tns, $user, $pwd) {
- if(!$this->connect = oci_connect($user,$pwd, $tns)) {
- $this->throwException('链接数据库错误!');
- }
- }
- /**
- * 新建一个游标
- *
- * @return <resource>
- */
- public function addCursor() {
- return oci_new_cursor($this->connect);
- }
- /**
- * 解析一条SQL语句
- *
- * @param <string> $sql
- * @return <resource>
- */
- public function parse($sql) {
- $this->stmt = oci_parse($this->connect, $sql);
- return $this;
- }
- /**
- * 绑定一个参数
- *
- * @param <string> $name
- * @param <mixed> $var
- * @param <int> $length
- * @param <int> $type
- * @return <resource>
- */
- public function bind($name, $var, $length = 10, $type = SQLT_INT) {
- oci_bind_by_name($this->stmt, $name, $var, $length, $type);
- return $this;
- }
- /**
- * 执行一条SQL语句
- *
- * @param <mixed> $stmt
- * @return <resource>
- */
- public function execute($stmt = null) {
- if($stmt) {
- oci_execute($stmt);
- } else {
- oci_execute($this->stmt);
- }
- return $this;
- }
- /**
- * 获取结果集
- *
- * @param <mixed> $stmt
- * @return <array>
- */
- public function getAll($stmt = null) {
- if($stmt) {
- while ($row = oci_fetch_array ($stmt, OCI_ASSOC)) {
- $rows[] = $row;
- }
- } else {
- while ($row = oci_fetch_array ($this->stmt, OCI_ASSOC)) {
- $rows[] = $row;
- }
- }
- return $rows;
- }
- /**
- * 抛出一个异常信息
- *
- * @param string $message
- */
- protected function throwException($message) {
- throw new Exception($message);
- }
- }
- ?>
使用例子:(最下面有下载)
如何在Oracle中获取有游标的存储过程的结果集.
在工作中遇到的..网上查了写的也不详细..再此做下笔记.
- $tns = "
- (DESCRIPTION =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
- )
- (CONNECT_DATA =
- (SERVICE_NAME = cnc)
- )
- )
- ";
- $db_username = "test";
- $db_password = "test";
- $conn = oci_connect($db_username,$db_password, $tns);
- $id = 1;
- //创建一个游标
- $cur = oci_new_cursor($conn);
- $sql = "begin packname.someproceduce( :id, :cousor); end;";
- $stmt = oci_parse($conn,$sql);
- oci_bind_by_name($stmt,":id",$id);
- //绑定cursor变量,注意$sql语句中:cursor变量的位置
- oci_bind_by_name($stmt,":cousor",$cur,-1,OCI_B_CURSOR);
- oci_execute($stmt);
- oci_execute($cur);
- while ($row = oci_fetch_array ($cur, OCI_ASSOC)) {
- print_r($row);
- }
分类目录
- ActionScript (2)
- CSS (25)
- Java (3)
- JavaScript (41)
- PHP (105)
- 心情杂谈 (34)
- 收集整理 (77)
- 本站原创 (55)
最近文章
- 将google ssl设置为IE8的默认搜索引擎..
- 我们来做一个会呼吸的菜单吧!!
- 在编译php-fpm0.6的时候需要注意的一些问题
- 使用PHP将大文件导入到数据库中..
- 关于用PHP调用WebService中参数为complexType的问题
- 神奇的两次按位非运算符
- 百路推免费短网址服务..首创”收藏夹获取短网址”..
- 哥学社正式上线..
- jQuery中getJSON跨域原理详解
- Web辅助工具条(原名:河蟹工具条CrabBar)0.1发布
- 腾讯微博PC端发图教程
- goo.gl URL Shortener for WordPress
- PHP上传进度条深度解析
- Google短网址(goo.gl)服务类
- TinyURL.class.php
最近评论
- 匿名 在 一个PHP+AJAX留言板的完整例子.非常简单! 上的评论
- pfeng 在 将google ssl设置为IE8的默认搜索引擎.. 上的评论
- pfeng 在 将google ssl设置为IE8的默认搜索引擎.. 上的评论
- 北戴河旅游住宿 在 PHPer的历练 上的评论
- konakona 在 将google ssl设置为IE8的默认搜索引擎.. 上的评论
- 宁静致远 在 PHPer的历练 上的评论
- Corsair_Boss 在 强人作品 – jQuery1.2.6源码分析 上的评论
- fanglor 在 PHPer的历练 上的评论
- fanglor 在 百路推免费短网址服务..首创”收藏夹获取短网址”.. 上的评论
- 匿名 在 Web辅助工具条(原名:河蟹工具条CrabBar)0.1发布 上的评论
文章索引模板
- 2010年七月 (3)
- 2010年六月 (4)
- 2010年五月 (2)
- 2010年四月 (9)
- 2010年三月 (12)
- 2010年二月 (1)
- 2010年一月 (3)
- 2009年十二月 (2)
- 2009年十一月 (3)
- 2009年十月 (3)
- 2009年九月 (5)
- 2009年八月 (4)
- 2009年七月 (6)
- 2009年六月 (8)
- 2009年五月 (8)
- 2009年四月 (16)
- 2009年三月 (19)
- 2009年二月 (22)
- 2009年一月 (20)
- 2008年十二月 (38)
- 2008年十一月 (22)
- 2008年十月 (7)
- 2008年九月 (3)
- 2008年八月 (24)
标签
.net
AJAX
button
Comet
CSS
Discuz!
DIV+CSS
Flash
Form
Google
HTML编辑器
IE8
Java
JavaScript
jQuery
JSP
md5
MySQLReback
Oracle
PHP
php-fpm
PNG
Punny
SkiyoTabs
tab
TagCloud
Vista
Web2.0
Windows7
上传
加密
变量
图标
本站原创
模板
模板引擎
源码
登录
短网址
石家庄
算法
类
编译
面向对象
魔术方法

Jessica
