This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Robert? - Creating a Custom Table dynamically using CREATE TABLE
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 31, 2007
11:46 AM
Robert? - Creating a Custom Table dynamically using CREATE TABLE
Is it possible to dynamically create a temporary custom table (Direct Editor) using CREATE TABLE or using any other method?
The idea is I create a table on the fly and populate it at run time during an installation it then dissapears after the end of the instalaltion.
Ive tried using CREATE TABLE cant seem to get it to work, any example code perforking this task would be great.
A temporary workaround is to just create an empty table but it then persists.
Thanks
The idea is I create a table on the fly and populate it at run time during an installation it then dissapears after the end of the instalaltion.
Ive tried using CREATE TABLE cant seem to get it to work, any example code perforking this task would be great.
A temporary workaround is to just create an empty table but it then persists.
Thanks
(5) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 31, 2007
12:15 PM
I haven't tried myself, so I don't know from memory; what code have you tried? What was the error?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 01, 2007
07:50 AM
RobertDickau wrote:
I haven't tried myself, so I don't know from memory; what code have you tried? What was the error?
Rough Example:
step1 query
CREATE TABLE `Temp` (`ID` INT(2) NOT NULL, `Name` CHAR(72),
NOT NULL PRIMARY KEY `ID`)
step2 create a view - creates handle to view
step3 execute view
step4 ModifyView with view handle , MSIMODIFY_INSERT_TEMPORARY, hRecord = 0
Just wondered if there was any example code floating aroundas I think Im going about this the wrong way, I can select records no problem using SELECT.
Cheers
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 01, 2007
10:16 AM
What language (InstallScript, C, VBScript, ...)? What error number or message?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 01, 2007
10:47 AM
As a sloppy example (needs error checking, proper cleanup, formatting, spelling checker, sensible variable names, much more), this seems to work as a VBScript custom action:
Const msiViewModifyInsertTemporary = 7Standard caution about database being unloaded between the UI and Execute sequences, so choose the action placement carefully...
' create the temporary table
Set oView = _
Database.OpenView("CREATE TABLE `FakeTable`" & _
"(`FirstColumn` CHAR(72) NOT NULL, " & _
" `SecondColumn` CHAR(72) PRIMARY KEY `FirstColumn`)")
oView.Execute
oView.Close: Set oView = Nothing
' add one temp record
Set oView2 = Database.OpenView("SELECT * FROM `FakeTable`")
oView2.Execute
Set newrec = Installer.CreateRecord(2)
newrec.StringData(1) = "FakeFirstColumnValue"
newrec.StringData(2) = "FakeSecondColumnValue"
oView2.Modify msiViewModifyInsertTemporary, newrec
oView2.Close: Set oView2 = Nothing
' read back the temp record
Set oView3 = Database.OpenView("SELECT * FROM `FakeTable`")
oView3.Execute
' assuming only one record; normally this is a loop
Set oRec = oView3.Fetch
MsgBox "Reading back temp data: " & _
oRec.StringData(1) & ", " & oRec.StringData(2)
oView3.Close: Set oView3 = Nothing
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 03, 2007
02:11 AM
Thanks Robert I got it working now, your code pointed me in the right direction.
Incidentally I was using Installscript.
Incidentally I was using Installscript.