Bugs item #1440141, was opened at 2006-02-27 22:42
Message generated for change (Settings changed) made by robmen
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=642714&aid=1440141&group_id=105970

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: extensions
Group: v2.0
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Michael Osmond (mosmond)
>Assigned to: Rob Mensching (robmen)
Summary:  ConfirmOverwrite in Create SQL Database not working

Initial Comment:
Using the SQL Database  Element.

Appears to be a bug where if you set ConfirmOverwrite 
to yes, and the installer prompts that a database 
exists, continue yes/no; if I select no, the install 
scripts are
executed anyway.   I am not actually a developer, but 
I took a look at
the CustomAction and I think there is a problem in 
scaexec.cpp - 

In the function CreateDatabase

        if (iAttributes & SCADB_CONFIRM_OVERWRITE)
        {
                // Check if the database already 
exists
                hr = SqlDatabaseExists(pwzServer, 
pwzInstance, pwzDatabase, fIntegratedAuth, pwzUser, 
pwzPassword, &bstrErrorDescription);
                MessageExitOnFailure2(hr, 
msierrSQLFailedCreateDatabase, "failed to check if 
database exists: '%S', error: %S", pwzDatabase, NULL 
== bstrErrorDescription ? L"unknown error" : 
bstrErrorDescription);

                if (S_OK == hr) // found an existing 
database, confirm that they don't want to stop before 
it gets trampled
                {
                        if (IDNO ==
WcaErrorMessage(msierrSQLDatabaseAlreadyExists, hr, 
MB_YESNO, 1,
pwzDatabase))
                                ExitOnFailure
(hr, "failed to
initialize");
                }
        }

1. hr holds the result of SqlDatabaseExists - which 
is true in the case of this problem.
2. The CA then prompts with a datbase already exists -
 and if the answer is IDNO then it calls 
ExitOnFailure. 
3. But if I read ExitOnFailure(hr, ...) correct, it 
only fails if hr is false, but this will still be 
true as per 1.
4. Result is the CA continues to process the 
CreateDatabase on a response of either yes or no.

Michael

----------------------------------------------------------------------

Comment By: Jason A. (jasona941)
Date: 2006-06-27 06:55

Message:
Logged In: YES 
user_id=1546905

I'm using version 2.0.3719.0 and also seeing the same problem.
I noticed that the CreateDatabase function has been fixed so
that the HRESULT passed to ExitOnFailure is a FAILED hr.
Unfortunately, the problem persists -- an existing database
is dropped even if the "NO" button on the ConfirmOverwrite
dialog is clicked by the user.

I went hunting for the sca.wxilib source and found the
sca.wxs file. In it I see a CustomAction setup to execute
the DropDatabase function on rollback. But I don't see any
checks (either in the DropDatabase or the Wix source)
preventing an existing database being dropped. Here's the
relevant lines from the sca Wix source:

<CustomAction Id="ConfigureSql" BinaryKey="ScaSchedule"
DllEntry="ConfigureSql" Execute="immediate" Return="check" />
    <CustomAction Id="CreateDatabase" BinaryKey="ScaExecute"
DllEntry="CreateDatabase" Execute="deferred" Return="check" />
    <CustomAction Id="RollbackCreateDatabase"
BinaryKey="ScaExecute" DllEntry="DropDatabase"
Execute="rollback" Return="check" />


----------------------------------------------------------------------

Comment By: DGutride (dgutride)
Date: 2006-05-15 07:25

Message:
Logged In: YES 
user_id=1204611

I've noticed this same behavior.  When the confirm overwrite
prompt shows up, if you say don't overwrite, the scripts
execute anyway and then the database was dropped when I
tested it.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=642714&aid=1440141&group_id=105970

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
WiX-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-devs

Reply via email to