[prev in list] [next in list] [prev in thread] [next in thread]
List: php-windows
Subject: [PHP-WIN] Re: COM - Problem with Dates
From: 77.181.207.212
Date: 2007-12-06 16:29:51
Message-ID: 8D.28.15167.38328574 () pb1 ! pair ! com
[Download RAW message or body]
> Hi,
> I have problems fetching data from an special database over a com-based
> sdk. With VisualBasic it's not a problem,
> but the same code doesn't work with php.
>
> First some Data:
> - The database system holds high compressed industrial data and is called
> OSI-PI. The system itself is under a
> comercial license (OSI Soft Inc.).
> - The distributor gave us a sdk - fully OO.
> - The sdk has to be integrated over COM.
> - My 1. testsystem: Windows 2000 Professional Version 5.00.2195 with php
> 5.2.2
> - My 2. testsystem: Windows 2003 Server with php 5.2.4
>
> Here a code-sniplet from me that work:
> 1 <?php
> 2 $comObjPi = new COM('PISDK.PISDK');
> 3 $server = $comObjPi->Servers->Item("123.123.123.123");
> 4 $server->Open("123.123.123.123;UID=foo;pwd=bar");
> 5 $point = $server->PIPoints("SINUSOID");
> 6 echo "\n".$point->Data->SnapShot()->Value."\n";
> 7 echo "\n".$point->Data->SnapShot()->TimeStamp."\n";
> 8 ?>
>
> Line 2 makes an object from the sdk. Line 3 and 4 builds up the connection
> to the server. Line 5 connects to
> an datapoint (PI-Point/Sinosoid is a testpoint). Line 6 and 7 receive the
> last value and the last time that are stored
> in the point. Everything WORKS FINE.
>
> But when we use some other functions of the sdk, php throws some
> exceptions:
>
> 9 com_load_typelib('PISDK.PISDK');
> 10 echo "\nTest 1:\n";
> 11 try{
> 12 $value = $point->Data->ArcValue(new Variant(mktime(), VT_R8),
> rtBefore);
> 13 }
> 14 catch(Exception $e){
> 15 print("\nException Versuch 1 ".$e->getMessage()." TraceString:
> ".$e->getTraceAsString());
> 16 }
> 17
> 18 echo "\nTest 2:\n";
> 19 try{
> 20 $value =
> $point->Data->ArcValue(variant_date_from_timestamp(mktime()), rtBefore);
> 21 }
> 22 catch(Exception $e){
> 23 print("\nException Versuch 2 ".$e->getMessage()." TraceString:
> ".$e->getTraceAsString());
> 24 }
> 25
> 26 $server->Close();
> 27 ?>
>
> Line 12/20: The function ArcValue is designed for calling archived values
> from a pi-point. It needs two values.
> First the date/time as Long, Int, String..., nearly each format. The
> second value is a constant. We loaded all
> of them in Line 9. We tested all types of variant for the first value, but
> each time it throws the following exception:
>
> ---
> Test 1:
> Exception Test 1 Parameter 0: Typkonflikt. //Type-Mismatch in the english
> version
> TraceString: #0 C:\php_pi\pitest.php(12):
> variant->ArcValue(Object(variant), 6)
> #1 {main}
> Test 2:
> Exception Test 2 Parameter 0: Typkonflikt.
> TraceString: #0 C:\php_pi\pitest.php(20):
> variant->ArcValue(Object(variant), 6)
> #1 {main}
> ----
>
> We tested other functions from the sdk. But each time we tried we lose.
> :-/ Fololowing an example written in
> VisualBasic that works fine:
>
> Imports pisdk
> Public Class Form1
> Private Sub Form1_Click(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Me.Click
> Dim MySdk As New PISDK.PISDK
> Dim pt As PIPoint
> Dim v As PIValues
> pt = MySdk.Servers.DefaultServer.PIPoints("sinusoid")
> v = pt.Data.PlotValues("1-Jan-07", "*", 1000)
> MsgBox(v.Count & " Elements")
> End Sub
> End Class
>
> It receives all datarows for the point "sinusoid" since first Jan and
> counts them. This example works with
> VisualBasic but it didn't work on php.
>
> Some programmers of OSI-Soft said that all functions takes objects as
> parameter so the type-mismatch is a
> problem in php. Because of the working VB code I think they are right.
>
> Has anyone a hint for me or a likewise problem with an other
> sdk/application?
>
> Regards
> Oliver
I've reported the problem as php-bug.
http://bugs.php.net/43521
--
Mit freundlichen Grüßen / Best Regards
Oliver Espeter
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic