OCIDefineByName函数中第二个参数只认大写字符串


PHP网页代码中,使用到OCIDefineByName函数,测试了后,发现第二个参数只认大写字符串。

附录,查找了一下这个函数的用法

OCIDefineByName

让 SELECT 指令可使用 PHP 变量。

语法: boolean OCIDefineByName(int stmt, string ColumnName, mixed &variable, int [type]);

返回值: 布尔值

函数种类: 数据库功能


内容说明

本函数用来定义指定的 PHP 变量,使其能供 SQL 指令中的 SELECT 指令使用。在大小写的问题上要注意一下,因为 Oracle 数据库中的字段名称其实都是大写的名字。参数 stmt 是经过 Oracle 解析 (OCIParse) 后的字符串指针。参数 ColumnName 是 Oracle 资料表上的字段名称。参数 variable 前面一定要加 & 符号,表 PHP 变量位址。参数 type 通常省略。注意的是欲使用 Oracle 8 中特有的新资料类型 LOB/ROWID/BFILE 等时,需要先执行 OCINewDescriptor() 函数。执行本函数成功则返回 true 值。

if (!($conn = OCILogon("mobile_query", "mobile_query", "fids"))) {
                    $this->con_temp = "网络连接错误!";
                } else {
                    $sql = "select 'd' as scaord, flight as VSIOFLIGHTNO,to_char(flight.flight_pkg.GET_DATETIME(sdt),'yyyy-MM-dd') as sdate,domint,stime,cs_type,'广州' as aanam, ROUTE_N_1_L as banam,ORDEST_N_L as canam ,(select  al.description_2 from airl al  where al.carrier_iata=v.CARRIER_IATA and rownum<2) as airline,to_char(flight.flight_pkg.GET_DATETIME(sdt),'HH24:MI') as sdt,to_char(flight.flight_pkg.GET_DATETIME(est_d),'HH24:MI') as est_d,to_char(flight.flight_pkg.GET_DATETIME(act_d),'HH24:MI') as act_d,park_1,remark_l as status,rem_c_2,gate_1 as belt_gate,checkins as ex_check from depf_v v where to_date(flight.flight_pkg.GET_DATETIME(v.sdt),'yyyy-MM-dd')=to_date(sysdate,'yyyy-MM-dd') and lower(v.flight) = lower('" . $keyword . "')";
                    $sql = $sql . " union all ";
                    $sql = $sql . "select 'a' as scaord, flight as VSIOFLIGHTNO,to_char(flight.flight_pkg.GET_DATETIME(sdt),'yyyy-MM-dd') as sdate,domint,stime,cs_type,ORDEST_N_L as aanam ,ROUTE_N_1_L as banam, '广州' as canam, (select  al.description_2 from airl al  where al.carrier_iata=v.CARRIER_IATA and rownum<2) as airline,to_char(flight.flight_pkg.GET_DATETIME(sdt),'HH24:MI') as sdt,to_char(flight.flight_pkg.GET_DATETIME(est_d),'HH24:MI') as est_d,to_char(flight.flight_pkg.GET_DATETIME(act_d),'HH24:MI') as act_d,park_1,remark_l as status,rem_c_2,belt_1 as belt_gate,exits as ex_check from arrf_v v where to_date(flight.flight_pkg.GET_DATETIME(v.sdt),'yyyy-MM-dd')=to_date(sysdate,'yyyy-MM-dd') and lower(v.flight) = lower('" . $keyword . "')";
                    $stmt = oci_parse($conn, $sql);
										
                    OCIDefineByName($stmt, "SCAORD", &$scaord);
                    OCIDefineByName($stmt, "VSIOFLIGHTNO", &$vsiofightno);
                    OCIDefineByName($stmt, "SDATE", &$sdate);
                    OCIDefineByName($stmt, "DOMINT", &$domint);
                    OCIDefineByName($stmt, "STIME", &$stime);
                    OCIDefineByName($stmt, "CS_TYPE", &$cs_type);
                    OCIDefineByName($stmt, "AANAM", &$aanam);
                    OCIDefineByName($stmt, "BANAM", &$banam);
                    OCIDefineByName($stmt, "CANAM", &$canam);
                    OCIDefineByName($stmt, "AIRLINE", &$airline);
                    OCIDefineByName($stmt, "SDT", &$sdt);
                    OCIDefineByName($stmt, "EST_D", &$est_d);
                    OCIDefineByName($stmt, "ACT_D", &$act_d);
                    OCIDefineByName($stmt, "PARK_1", &$park_1);
                    OCIDefineByName($stmt, "STATUS", &$status);
                    OCIDefineByName($stmt, "REM_C_2", &$rem_c_2);
                    OCIDefineByName($stmt, "BELT_GATE", &$belt_gate);
                    OCIDefineByName($stmt, "EX_CHECK", &$ex_check);
                    if (!oci_execute($stmt)) {
                        $oerr = OCIError($stmt);
                        $this->con_temp += "Execute Code:" . $oerr["code"];
                        if ($oerr["code"]) {
                            $this->con_temp += "Error:" . $oerr["message"];
                        }
                    } else {
                        if (OCIFetch($stmt)) {
                            $this->con_temp = $airline . "[" . $vsiofightno . "]的航班信息是:\n";
                            if ($sdate) {
                                $this->con_temp = $this->con_temp . "[航班日期]:" . $sdate . "\n";
                            }                            
                            if ($aanam) {
                                $this->con_temp = $this->con_temp . "[航程]:" . $aanam . "-->";
                            }                            
                            if ($banam) {
                                $this->con_temp = $this->con_temp . $banam . "-->";
                            }
                            if ($canam) {
                                $this->con_temp = $this->con_temp . $canam . "\n";
                            }
                            if ($ex_check) {
                                $this->con_temp = $this->con_temp . (($scaord == "d") ? "[值机柜台]:" : "[登机口]:") . $ex_check . "\n";
                            }
                            if ($sdt) {
                                $this->con_temp = $this->con_temp . (($scaord == "d") ? "[计划起飞时间]:" : "[计划到达时间]:") . $sdt . "\n";
                            }
                            if ($est_d) {
                                $this->con_temp = $this->con_temp . (($scaord == "d") ? "[预计起飞时间]:" : "[预计到达时间]:") . $est_d . "\n";
                            }
                            if ($act_d) {
                                $this->con_temp = $this->con_temp . (($scaord == "d") ? "[实际起飞时间]:" : "[实际到达时间]:") . $act_d . "\n";
                            }
                            if ($park_1) {
                                $this->con_temp = $this->con_temp . "[飞机停机位]:" . $park_1 . "\n";
                            }
                            if ($belt_gate) {
                                $this->con_temp = $this->con_temp . (($scaord == "d") ? "[登机口]:" : "[行李转盘]:") . $belt_gate . "\n";
                            }
                            if ($status) {
                                $this->con_temp = $this->con_temp . "[航班目前状态]:" . $status . "\n";
                            }
                        } else {
                            $this->con_temp += "您所查找的航班号码[" . $keyword . "],航班信息暂无\n";
                        }
                    }
                    OCIFreeStatement($stmt);
                }
                OCILogoff($conn);




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

机场信息系统研究员

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值