I need query to create binary table using wix code and C#.
eg: i am able to create 'AppSearch' table if not present in the msi using the code below
Database database = new Database(tempmsiPath, DatabaseOpenMode.Direct);
string query = "CREATE TABLE `AppSearch` (`Property` CHAR(255) NOT NULL, `Signature_`
CHAR(255) NOT NULL PRIMARY KEY `Property`)";
database.Execute(query);
but when i try
query = "CREATE TABLE `Binary` (`Name` CHAR(255) NOT NULL, `Data` Binary NOT NULL
PRIMARY KEY `Name`)";
database.Execute(query);
i get the error "BadQuerySyntaxException was caught"
SQL query syntax invalid or unsupported. Database: \c:\xx.msi. Invalid type specifier 'Binary' in SQL query CREATE TABLE Binary
(Name
CHAR(255) NOT NULL, Data
Binary NOT NULL PRIMARY KEY Name
).
The reason i need this is I need to add entries to binary table but some times msi does not have binary table in such cases i need to create the table otherwise i get error unknown table binary.
Is there any any other way to create predefined table 'Binary' using c# code and WIX or let me know what i was missing?
Thanks!
I was under the impression you used WiX to build your MSI and was missing the Binary table. If you didn't build the MSI and are trying to add the Binary table ( you would normally do this to create a transform not in the MSI itself ) then the easiest way would probably be:
One Time: Using ORCA: 1) Create an MSI 2) Add the Binary table to the MSI. ( Right Click, Add Table ) 3) Export the new table to an IDT file ( Right Click, Export Tables)
The result will be a file called Binary.idt. It'll look something like this: ( whitespaces are important as it's a tab delimited file so create it yourself; don't copy and paste )
Name Data
s72 v0
Binary Name
Now in DTF you can use the Import method on the Database object to import the IDT into the database as the Binary table.
database.ImportTable("Binary.idt");