Browsing all articles from 八月, 2009
27
5

分享大二时候做的一套模板.

Author Jessica     Category 本站原创     Tags

最初这个网站还开了一段时间.但是后来一直没管..现在都停了..

刚才整理电脑发现了..整理出来给大家看看..

那时候做的很幼稚..大家不要笑我..哈!!

由于全部是PNG做的..所以在IE6下严重走样:(

演示:

http://www.skiyo.cn/demo/shaiwww/

read more

19
16

Punny 1.0 Standard 正式发布…

Author Jessica     Category PHP     Tags

这次的版本修改是巨大的..很多人也跟我发过邮件.想必大家都等久了..

为了不让大家失望..这次我经过了很多的测试才放出来..同时将文档也重新写了一下..

可以说..这是一个全新的Punny..

至于到底变化有多大..大家去下下来源码..读一读文档就知道了:)..

直接给个传送门吧..那里什么都有了..

有问题给我发邮件:)

http://punny.skiyo.cn/

18
0

Oracle简单的带游标的存储过程操作类..

Author Jessica     Category PHP     Tags ,

上个帖子发了一个例子..后来为了自己操作方面..封装成了类…只是为了自己方便..所以也共享出来吧..

如果你再改一下..完善一下..充分可以当做一个Oracle操作类的.

  1. <?php  
  2. /**  
  3.  * Punny - The most easy-to-use PHP MVC framework  
  4.  * http://punny.skiyo.cn/  
  5.  *  
  6.  * Copyright (c) 2009 Jessica(董立强)  
  7.  * Licensed under the GPL licenses.  
  8.  *  
  9.  * @author Jessica<cndingo@qq.com>  
  10.  * @version $Id$  
  11.  */ 
  12. class Oracle {  
  13.  
  14.     /**  
  15.      *  
  16.      * @var <resource> 数据库链接  
  17.      */ 
  18.     private $connect;  
  19.     /**  
  20.      *  
  21.      * @var <resource> SQL语句标识  
  22.      */ 
  23.     private $stmt;  
  24.  
  25.     /**  
  26.      * 链接数据库  
  27.      *  
  28.      * @param <string> $tns  
  29.      * @param <string> $user  
  30.      * @param <string> $pwd  
  31.      */ 
  32.     public function __construct($tns$user$pwd) {  
  33.         if(!$this->connect = oci_connect($user,$pwd$tns)) {  
  34.             $this->throwException('链接数据库错误!');  
  35.         }  
  36.     }  
  37.  
  38.     /**  
  39.      * 新建一个游标  
  40.      *  
  41.      * @return <resource>  
  42.      */ 
  43.     public function addCursor() {  
  44.         return oci_new_cursor($this->connect);  
  45.     }  
  46.  
  47.     /**  
  48.      * 解析一条SQL语句  
  49.      *  
  50.      * @param <string> $sql  
  51.      * @return <resource>  
  52.      */ 
  53.     public function parse($sql) {  
  54.         $this->stmt = oci_parse($this->connect, $sql);  
  55.         return $this;  
  56.     }  
  57.  
  58.     /**  
  59.      * 绑定一个参数  
  60.      *  
  61.      * @param <string> $name  
  62.      * @param <mixed> $var  
  63.      * @param <int> $length  
  64.      * @param <int> $type  
  65.      * @return <resource>  
  66.      */ 
  67.     public function bind($name$var$length = 10, $type = SQLT_INT) {  
  68.         oci_bind_by_name($this->stmt, $name$var$length$type);  
  69.         return $this;  
  70.     }  
  71.  
  72.     /**  
  73.      * 执行一条SQL语句  
  74.      *  
  75.      * @param <mixed> $stmt  
  76.      * @return <resource>  
  77.      */ 
  78.     public function execute($stmt = null) {  
  79.         if($stmt) {  
  80.             oci_execute($stmt);  
  81.         } else {  
  82.             oci_execute($this->stmt);  
  83.         }  
  84.         return $this;  
  85.     }  
  86.  
  87.     /**  
  88.      * 获取结果集  
  89.      *  
  90.      * @param <mixed> $stmt  
  91.      * @return <array>  
  92.      */ 
  93.     public function getAll($stmt = null) {  
  94.         if($stmt) {  
  95.             while ($row = oci_fetch_array ($stmt, OCI_ASSOC)) {  
  96.         $rows[] = $row;  
  97.             }  
  98.         } else {  
  99.             while ($row = oci_fetch_array ($this->stmt, OCI_ASSOC)) {  
  100.         $rows[] = $row;  
  101.             }  
  102.         }  
  103.         return $rows;  
  104.     }  
  105.  
  106.  
  107.     /**  
  108.      * 抛出一个异常信息  
  109.      *  
  110.      * @param string $message  
  111.      */ 
  112.     protected function throwException($message) {  
  113.         throw new Exception($message);  
  114.     }  
  115. }  
  116. ?> 

使用例子:(最下面有下载)

read more

17
2

如何在Oracle中获取有游标的存储过程的结果集.

Author Jessica     Category PHP     Tags ,

在工作中遇到的..网上查了写的也不详细..再此做下笔记.

  1. $tns = "  
  2.           (DESCRIPTION =  
  3.             (ADDRESS_LIST =  
  4.               (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))  
  5.             )  
  6.             (CONNECT_DATA =  
  7.               (SERVICE_NAME = cnc)  
  8.             )  
  9.           )   
  10.         ";  
  11. $db_username = "test";  
  12. $db_password = "test";  
  13.  
  14. $conn = oci_connect($db_username,$db_password$tns);  
  15.  
  16.  
  17. $id = 1;  
  18. //创建一个游标  
  19. $cur = oci_new_cursor($conn);  
  20. $sql = "begin packname.someproceduce( :id, :cousor); end;";  
  21. $stmt = oci_parse($conn,$sql);  
  22.  
  23. oci_bind_by_name($stmt,":id",$id);  
  24. //绑定cursor变量,注意$sql语句中:cursor变量的位置  
  25. oci_bind_by_name($stmt,":cousor",$cur,-1,OCI_B_CURSOR);  
  26. oci_execute($stmt);  
  27. oci_execute($cur);  
  28.  
  29. while ($row = oci_fetch_array ($cur, OCI_ASSOC)) {  
  30.     print_r($row);  

分类目录

最近文章

最近评论

文章索引模板

标签

.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 上传 加密 变量 图标 本站原创 模板 模板引擎 源码 登录 短网址 石家庄 算法 编译 面向对象 魔术方法

链接表