Type column of _Columns table

  • Thread starter Thread starter =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
  • Start date Start date
?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

According to the MSDN documentation, the _Columns table has three
columns: Table, Number, and Name. However, I found that there is
a fourth column, "Type", of type "i2". Does anybody know what its
semantics is?

TIA,
Martin
 
Chris said:
The extra column is used internally by MSI to manage information about the
column. The exact semantics of this column have never been documented.

This is unfortunate, as the column has the information I need to
discover the CREATE TABLE statements that initialize an empty database.

Fortunately, I found that Wine has discovered most of this field;
I have augmented that further, so I only need to find out what the
meaning of bit 0x0400 is.

For anybody interested, the other bits are

0x00ff - size bit mask
0x0100 - valid field (?)
0x0200 - LOCALIZABLE
0x0800 - CHAR type
0x1000 - nullable
0x2000 - PRIMARY KEY

Regards,
Martin
 
The MsiViewGetColumnInfo API can get you all the information you need and is the
supported method for obtaining this information. Select the columns you are
interested in (or perform a "SELECT *" to simply grab everything in the table)
then call MsiViewGetColumnInfo to get both the names and\or the column types.

Reading the internal column state is dangerous both because the values could
concievably change and because correctly interpreting the values requires a
understanding of the internal implementation details of MSI. (In fact, the
definitions you list below are actually incorrect for many of the bits).

-Chris Gouge
Microsoft Windows Installer Team

This posting is provided "AS IS" with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.

MSI FAQ:
<http://www.microsoft.com/windows2000/community/centers/management/msi_faq.asp>
 
Chris said:
The MsiViewGetColumnInfo API can get you all the information you need and is the
supported method for obtaining this information. Select the columns you are
interested in (or perform a "SELECT *" to simply grab everything in the table)
then call MsiViewGetColumnInfo to get both the names and\or the column types.

This is a lot more expensive: to discover the entire schema, I have to
iterate over _Tables, and then perform SELECT* on each - even though I'm
not interested in a single record. It's also more tedious to obtain the
information, as MsiViewGetColumnInfo does *not* tell me what the primary
keys are.
Reading the internal column state is dangerous both because the values could
concievably change and because correctly interpreting the values requires a
understanding of the internal implementation details of MSI. (In fact, the
definitions you list below are actually incorrect for many of the bits).

It's really unfortunate that that no documentation is provided. Even if
the interpretation changes, there must be a mechanism somehwere to
detect the change, or else future installers might not be
backward-compatible with old packages.

With this post, I'm hoping that the community starts maintaining the
information that Microsoft is unwilling to provide.

This entire approach would not be necessary if there was, for each
schema version, a sequence of SQL statements that initializes the
schema, instead of a template database. I would then just incorporate
this series of statements into my MSI generator.

Regards,
Martin
 
Back
Top