[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"indexed" COM properties in MysterX?



Experimenting with the example given earlier by Alex Peake, I was unable to
find a way, in MysterX, to access "indexed" COM properties, i.e. properties
that take parameters.  An important example of this is the ADO Fields.Item
property, which is used to access database fields by name (or ordinal).  The
COM IDL definition of this property in the ADO Fields interface looks like
this:

	[id(00000000), propget]
	HRESULT Item( [in] VARIANT Index, [out, retval] Field** ppvObject );

Since the MysterX function "com-get-property" is designed to traverse a
property "path", there doesn't seem to be a way to specify a parameter to a
property.  Attempting to access an ADO field as follows:

	(display (com-get-property flds "Item" "Name"))

returns the error:

	...com-get-property (property "Item"): expects 3 arguments, given 2:
#<com-object> "Item""

since of course "Name" is being treated by com-get-property as another
property name, not as a parameter to the Item property.

Here's my complete test.  It works perfectly except for the last line.  (Of
course it still suffers from the repeated Execute problem under DrScheme).

	(require-library "mysterx.ss" "mysterx")
	(define conn (cci/progid "ADODB.Connection"))
	(com-invoke conn "Open" "DSN=epas;UID=sa;PWD=###")

	(define rs (com-invoke conn "Execute" "SELECT * FROM
SourceDocumentSubtypes"))

	(define flds (com-get-property rs "Fields"))
	(display (com-get-property flds "Count"))		; displays correct field count

	(display (com-get-property flds "Item" "Name"))

So, does MysterX have some other way of accessing properties that take
parameters?  I tried adding a function to mysterxe.ss modeled after that
module's com-get-property function, but I think I run into the same issue
with the underlying primitive function, and I don't have the source to that
(is the source available?)

Anton