[PHP] PHP5 COM get/set property trouble

2004-03-02 Thread Daniel Daley
Hi, I'm having difficulty trying to use the com extension in php5. 
Here's the asp equivalent of what I'm trying to do.

Set comobj = Server.CreateObject("MyComlib.ComLib")
comobj.FieldValue = "somedata"
myval = comobj.Property("Record")
comobj.Property("Record") = "otherdata"
My php code looks like this:

$comobj = &new COM('MyComlib.ComLib'); // Works
$comobj->FieldValue = "somedata";   // Works
$myval = $comobj->Property("Record");// Kind of 
Works.throws an exception if the value doesn't exist
$comobj->Property("Record") = "otherdata";  // Doesn't Work

I'm able to initialize the object and assign the FieldValue property 
some data. The last line however doesn't work and instead gives me:
PHP Fatal error: Can't use method return value in write context

It makes sense to me why that wouldn't work in php, but for the life of 
me I can't figure out what would make it work. I've tried with both the 
latest beta and the latest snaps release of php5 with the same results. 
I can't find any bug reports or mention of this happening to anyone, is 
this something that maybe just can't be done in php?

Thanks,

--Dan--

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP5 COM get/set property trouble

2004-03-03 Thread Daniel Daley

$comobj = &new COM('MyComlib.ComLib'); // Works
$comobj->FieldValue = "somedata";   // Works
$myval = $comobj->Property("Record");// Kind of 
Works.throws an exception if the value doesn't exist
$comobj->Property("Record") = "otherdata";  // Doesn't Work

I'm able to initialize the object and assign the FieldValue property 
some data. The last line however doesn't work and instead gives me:
PHP Fatal error: Can't use method return value in write context


Well, I was about to give up when I noticed the pecl extension php_perl. 
It turns out perl has a method to set properties that take parameters. I 
was able to successfully compile and install the extension and use the 
Perl() object to do work on the com objects that had properties like 
that. If anyone has any information about whetether setting properties 
with arguments is possible with strictly php or if that's a feature 
expected to be implemented I would still very much like to know.

Thanks,

--Dan--

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] compress data before inserting into mysql record?

2004-03-04 Thread Daniel Daley
Christian Calloway wrote:

I had a small question concerning how MySQL stores text and longtext fields.
Long story short, I have to store a large amount of "textual" data, and was
wondering if I should compress said data and then store it in the db, or
does MySQL already concern itself with compression (which would make it
pointless to pre-compress). Thank you
 

As far as I know MySQL doesn't do any compression on any fields. If this 
is a static unchanging set of data mysql does allow you to compress 
entire tables with the myisampack command but the table become 
read-only. As of MySQL version 4.1.1 you can use the functions 
COMPRESS() and UNCOMPRESS() in an sql query if the server was compiled 
with zlib (it will return null if it wasn't). Other than that you would 
have to compress the data yourself using php functions before inserting 
it. You would want to store data in a BLOB/LONGBLOB column either way 
though since it is now binary data.

--Dan--

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php