本文整理汇总了PHP中COM::CreateParameter方法的典型用法代码示例。如果您正苦于以下问题:PHP COM::CreateParameter方法的具体用法?PHP COM::CreateParameter怎么用?PHP COM::CreateParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COM
的用法示例。
在下文中一共展示了COM::CreateParameter方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: COM
function &_query($sql, $inputarr = false)
{
try {
// In PHP5, all COM errors are exceptions, so to maintain old behaviour...
$dbc = $this->_connectionID;
// return rs
if ($inputarr) {
if (!empty($this->charPage)) {
$oCmd = new COM('ADODB.Command', null, $this->charPage);
} else {
$oCmd = new COM('ADODB.Command');
}
$oCmd->ActiveConnection = $dbc;
$oCmd->CommandText = $sql;
$oCmd->CommandType = 1;
foreach ($inputarr as $val) {
// name, type, direction 1 = input, len,
$this->adoParameterType = 130;
$p = $oCmd->CreateParameter('name', $this->adoParameterType, 1, strlen($val), $val);
//print $p->Type.' '.$p->value;
$oCmd->Parameters->Append($p);
}
$p = false;
$rs = $oCmd->Execute();
$e = $dbc->Errors;
if ($dbc->Errors->Count > 0) {
return false;
}
return $rs;
}
$rs = @$dbc->Execute($sql, $this->_affectedRows, $this->_execute_option);
if ($dbc->Errors->Count > 0) {
return false;
}
if (!$rs) {
return false;
}
if ($rs->State == 0) {
return true;
}
// 0 = adStateClosed means no records returned
return $rs;
} catch (exception $e) {
}
return false;
}
示例2: COM
function _query($sql,$inputarr=false)
{
try { // In PHP5, all COM errors are exceptions, so to maintain old behaviour...
$dbc = $this->_connectionID;
// return rs
$false = false;
if ($inputarr) {
if (!empty($this->charPage))
$oCmd = new COM('ADODB.Command',null,$this->charPage);
else
$oCmd = new COM('ADODB.Command');
$oCmd->ActiveConnection = $dbc;
$oCmd->CommandText = $sql;
$oCmd->CommandType = 1;
while(list(, $val) = each($inputarr)) {
$type = gettype($val);
$len=strlen($val);
if ($type == 'boolean')
$this->adoParameterType = 11;
else if ($type == 'integer')
$this->adoParameterType = 3;
else if ($type == 'double')
$this->adoParameterType = 5;
elseif ($type == 'string')
$this->adoParameterType = 202;
else if (($val === null) || (!defined($val)))
$len=1;
else
$this->adoParameterType = 130;
// name, type, direction 1 = input, len,
$p = $oCmd->CreateParameter('name',$this->adoParameterType,1,$len,$val);
$oCmd->Parameters->Append($p);
}
$p = false;
$rs = $oCmd->Execute();
$e = $dbc->Errors;
if ($dbc->Errors->Count > 0) return $false;
return $rs;
}
$rs = @$dbc->Execute($sql,$this->_affectedRows, $this->_execute_option);
if ($dbc->Errors->Count > 0) return $false;
if (! $rs) return $false;
if ($rs->State == 0) {
$true = true;
return $true; // 0 = adStateClosed means no records returned
}
return $rs;
} catch (exception $e) {
}
return $false;
}
示例3: COM
function _query($sql, $inputarr = false)
{
$dbc = $this->_connectionID;
$false = false;
// return rs
if ($inputarr) {
if (!empty($this->charPage)) {
$oCmd = new COM('ADODB.Command', null, $this->charPage);
} else {
$oCmd = new COM('ADODB.Command');
}
$oCmd->ActiveConnection = $dbc;
$oCmd->CommandText = $sql;
$oCmd->CommandType = 1;
// Map by http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdmthcreateparam.asp
// Check issue http://bugs.php.net/bug.php?id=40664 !!!
while (list(, $val) = each($inputarr)) {
$type = gettype($val);
$len = strlen($val);
if ($type == 'boolean') {
$this->adoParameterType = 11;
} else {
if ($type == 'integer') {
$this->adoParameterType = 3;
} else {
if ($type == 'double') {
$this->adoParameterType = 5;
} elseif ($type == 'string') {
$this->adoParameterType = 202;
} else {
if ($val === null || !defined($val)) {
$len = 1;
} else {
$this->adoParameterType = 130;
}
}
}
}
// name, type, direction 1 = input, len,
$p = $oCmd->CreateParameter('name', $this->adoParameterType, 1, $len, $val);
$oCmd->Parameters->Append($p);
}
$p = false;
$rs = $oCmd->Execute();
$e = $dbc->Errors;
if ($dbc->Errors->Count > 0) {
return $false;
}
return $rs;
}
$rs = @$dbc->Execute($sql, $this->_affectedRows, $this->_execute_option);
if ($dbc->Errors->Count > 0) {
return $false;
}
if (!$rs) {
return $false;
}
if ($rs->State == 0) {
$true = true;
return $true;
// 0 = adStateClosed means no records returned
}
return $rs;
}
示例4: COM
function _query($sql, $inputarr = false)
{
$dbc = $this->_connectionID;
$false = false;
if ($inputarr) {
if (!empty($this->charPage)) {
$oCmd = new COM('ADODB.Command', null, $this->charPage);
} else {
$oCmd = new COM('ADODB.Command');
}
$oCmd->ActiveConnection = $dbc;
$oCmd->CommandText = $sql;
$oCmd->CommandType = 1;
foreach ($inputarr as $val) {
$this->adoParameterType = 130;
$p = $oCmd->CreateParameter('name', $this->adoParameterType, 1, strlen($val), $val);
$oCmd->Parameters->Append($p);
}
$p = false;
$rs = $oCmd->Execute();
$e = $dbc->Errors;
if (0 < $dbc->Errors->Count) {
return $false;
}
return $rs;
}
$rs = @$dbc->Execute($sql, $this->_affectedRows, $this->_execute_option);
if (0 < $dbc->Errors->Count) {
return $false;
}
if (!$rs) {
return $false;
}
if ($rs->State == 0) {
$true = true;
return $true;
}
return $rs;
}
示例5: COM
function &_query($sql,$inputarr=false)
{
$dbc = $this->_connectionID;
$false = false;
// return rs
if ($inputarr) {
if (!empty($this->charPage))
$oCmd = new COM('ADODB.Command',null,$this->charPage);
else
$oCmd = new COM('ADODB.Command');
$oCmd->ActiveConnection = $dbc;
$oCmd->CommandText = $sql;
$oCmd->CommandType = 1;
foreach($inputarr as $val) {
// name, type, direction 1 = input, len,
$this->adoParameterType = 130;
$p = $oCmd->CreateParameter('name',$this->adoParameterType,1,strlen($val),$val);
//print $p->Type.' '.$p->value;
$oCmd->Parameters->Append($p);
}
$p = false;
$rs = $oCmd->Execute();
$e = $dbc->Errors;
if ($dbc->Errors->Count > 0) return $false;
return $rs;
}
$rs = @$dbc->Execute($sql,$this->_affectedRows, $this->_execute_option);
if ($dbc->Errors->Count > 0) return $false;
if (! $rs) return $false;
if ($rs->State == 0) {
$true = true;
return $true; // 0 = adStateClosed means no records returned
}
return $rs;
}
示例6: COM
function &_query($sql, $inputarr = false)
{
$dbc = $this->_connectionID;
// return rs
if ($inputarr) {
$oCmd = new COM('ADODB.Command');
$oCmd->ActiveConnection = $dbc;
$oCmd->CommandText = $sql;
$oCmd->CommandType = 1;
foreach ($inputarr as $val) {
// name, type, direction 1 = input, len,
$this->adoParameterType = 130;
$p = $oCmd->CreateParameter('name', $this->adoParameterType, 1, strlen($val), $val);
//print $p->Type.' '.$p->value;
$oCmd->Parameters->Append($p);
}
$p = false;
$rs = $oCmd->Execute();
$e = $dbc->Errors;
if ($dbc->Errors->Count > 0) {
return false;
}
return $rs;
}
$rs = @$dbc->Execute($sql, $this->_affectedRows);
if ($dbc->Errors->Count > 0) {
return false;
}
return $rs;
}