Discussion:
[WiX-users] DTF: Missing Session Tables?
Scott Davis
2010-05-18 19:06:44 UTC
Permalink
I'm writing my first custom action using DTF from WiX 3.0.5419.0, and I'm
having an interesting issue: it appears that all of the MSI tables are not
accessible to my custom action. I'm using InstallShield 2010, and have set
up the custom action to run as an MSI custom action.

[CustomAction]
public static ActionResult Testing(Session session)
{
foreach (TableInfo table in session.Database.Tables)
{
Debug.WriteLine(table.Name);
}
return ActionResult.Success;
}

The following tables are written:
ActionText
AdminExecuteSequence
AdminUISequence
AdvtExecuteSequence
AdvtUISequence
Property
Binary
File
CheckBox
Component
Icon
ComboBox

Am I missing something here? Any query to a table not listed here throws an
exception, as the table doesn't exist...

Even more confusing - when I debug, session.Database.Tables.Count = 45.

Thanks in advance,
Scott
--
View this message in context: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/DTF-Missing-Session-Tables-tp5071597p5071597.html
Sent from the wix-users mailing list archive at Nabble.com.
Christopher Painter
2010-05-18 22:05:38 UTC
Permalink
Session is an object not a Windows Installer table.
 
Christopher Painter, Author of Deployment Engineering Blog
Have a hot tip, know a secret or read a really good thread that deserves attention? E-Mail Me



----- Original Message ----
From: Scott Davis <***@gmail.com>
To: wix-***@lists.sourceforge.net
Sent: Tue, May 18, 2010 2:06:44 PM
Subject: [WiX-users] DTF: Missing Session Tables?


I'm writing my first custom action using DTF from WiX 3.0.5419.0, and I'm
having an interesting issue: it appears that all of the MSI tables are not
accessible to my custom action.  I'm using InstallShield 2010, and have set
up the custom action to run as an MSI custom action.

[CustomAction]
public static ActionResult Testing(Session session)
{
  foreach (TableInfo table in session.Database.Tables)
  {
      Debug.WriteLine(table.Name);
  }
  return ActionResult.Success;
}

The following tables are written:
ActionText
AdminExecuteSequence
AdminUISequence
AdvtExecuteSequence
AdvtUISequence
Property
Binary
File
CheckBox
Component
Icon
ComboBox

Am I missing something here?  Any query to a table not listed here throws an
exception, as the table doesn't exist...

Even more confusing - when I debug, session.Database.Tables.Count = 45.

Thanks in advance,
Scott
--
View this message in context: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/DTF-Missing-Session-Tables-tp5071597p5071597.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Scott Davis
2010-05-19 03:30:00 UTC
Permalink
I thought that calling Session.Database would give me the database object for
the installation. What is confusing to me is that
Session.Database.Tables.Count is returning 45, but iterating through
Session.Database.Tables is only showing me 12 tables. I would expect to see
45 tables by iterating through. Shouldn't I be able to see the other
tables, such as 'Control'?

In any event, DTF might just be the wrong technology for what I'm trying to
do. I need to edit the MSI database dynamically at runtime, and it looked
like DTF would be good for that, but if I can only get the database in read
only mode, I'm going to just have to bite the bullet and use P/Invoke to do
my editing.

Short of recompiling the library to give me write access to the in-memory
database, is there a way I could get write access?

Thanks.
--
View this message in context: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/DTF-Missing-Session-Tables-tp5071597p5073176.html
Sent from the wix-users mailing list archive at Nabble.com.
Christopher Painter
2010-05-19 03:57:00 UTC
Permalink
I don't think Jason got around to creating classes for all of the various tables.  You can still hand write SQL queries to get to the other standard and/or custom tables in your database.




----- Original Message ----
From: Scott Davis <***@gmail.com>
To: wix-***@lists.sourceforge.net
Sent: Tue, May 18, 2010 10:30:00 PM
Subject: Re: [WiX-users] DTF: Missing Session Tables?


I thought that calling Session.Database would give me the database object for
the installation.  What is confusing to me is that
Session.Database.Tables.Count is returning 45, but iterating through
Session.Database.Tables is only showing me 12 tables.  I would expect to see
45 tables by iterating through.  Shouldn't I be able to see the other
tables, such as 'Control'?

In any event, DTF might just be the wrong technology for what I'm trying to
do.  I need to edit the MSI database dynamically at runtime, and it looked
like DTF would be good for that, but if I can only get the database in read
only mode, I'm going to just have to bite the bullet and use P/Invoke to do
my editing.

Short of recompiling the library to give me write access to the in-memory
database, is there a way I could get write access?

Thanks.
--
View this message in context: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/DTF-Missing-Session-Tables-tp5071597p5073176.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Jason Ginchereau
2010-05-19 20:02:05 UTC
Permalink
A database is read-only during an installation session. You may insert TEMPORARY columns and rows, but that is all. This is not a DTF limitation -- it's from the MSI runtime. So you won't be able to do anything via P/Invoke that you can't do using the DTF database APIs.

As for the discrepancy in the list of tables, I can't explain that. Both the TableCollection.Count property and the TableCollection.GetEnumerator() method use Database.ExecuteStringQuery("SELECT `Name` FROM `_Tables`") to get the list of tables in the MSI database, so I would expect the results to be consistent.

-Jason-

-----Original Message-----
From: Christopher Painter [mailto:***@deploymentengineering.com]
Sent: Tuesday, May 18, 2010 8:57 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] DTF: Missing Session Tables?

I don't think Jason got around to creating classes for all of the various tables.  You can still hand write SQL queries to get to the other standard and/or custom tables in your database.


----- Original Message ----
From: Scott Davis <***@gmail.com>
To: wix-***@lists.sourceforge.net
Sent: Tue, May 18, 2010 10:30:00 PM
Subject: Re: [WiX-users] DTF: Missing Session Tables?


I thought that calling Session.Database would give me the database object for the installation.  What is confusing to me is that Session.Database.Tables.Count is returning 45, but iterating through Session.Database.Tables is only showing me 12 tables.  I would expect to see
45 tables by iterating through.  Shouldn't I be able to see the other tables, such as 'Control'?

In any event, DTF might just be the wrong technology for what I'm trying to do.  I need to edit the MSI database dynamically at runtime, and it looked like DTF would be good for that, but if I can only get the database in read only mode, I'm going to just have to bite the bullet and use P/Invoke to do my editing.

Short of recompiling the library to give me write access to the in-memory database, is there a way I could get write access?

Thanks.
--
View this message in context: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/DTF-Missing-Session-Tables-tp5071597p5073176.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Loading...