Delete an ODBC entry: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Wikipedia python library) |
m (Adding new author and category links.) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{PageAuthor|preisl}} | |||
== The Function == | == The Function == | ||
<highlight-nsis>
; | <highlight-nsis> | ||
; | |||
; Delete an existing ODBC Entry | ; Delete an existing ODBC Entry | ||
; | ; | ||
Line 29: | Line 32: | ||
DeleteEntry: | DeleteEntry: | ||
; Check | ; Check whether the ODBC entry already exists | ||
Push $R0 | Push $R0 | ||
Call ${PREFIX}ODBCEntryExists | Call ${PREFIX}ODBCEntryExists | ||
Line 65: | Line 68: | ||
</highlight-nsis> | </highlight-nsis> | ||
[[Category:Database Functions]] |
Latest revision as of 12:04, 24 June 2005
Author: preisl (talk, contrib) |
The Function
; ; Delete an existing ODBC Entry ; ; Requires: ODBCEntryExists ; Input: Name of the ODBC entry ; Output: None ; ; Usage: ; ; Push "ODBCTEST" ; Call DeleteODBCEntry ; MessageBox MB_OK|MB_ICONINFORMATION "ODBC entry 'ODBCTEST' deleted" ; !macro DeleteODBCEntryMacro PREFIX ; Clear all errors first ClearErrors ; Pop the name of the ODBC entry from the stack Exch $R0 Push $R1 IfErrors InvalidParameter DeleteEntry InvalidParameter: MessageBox MB_OK|MB_ICONEXCLAMATION "DeleteODBCEntry: Please push the name of the ODBC entry first." Goto Done DeleteEntry: ; Check whether the ODBC entry already exists Push $R0 Call ${PREFIX}ODBCEntryExists Pop $R1 StrCmp $R1 "FALSE" Done ; Delete the registry keys ClearErrors DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\ODBC\ODBC.INI\$R0" IfErrors ErrorKey DeleteValue ErrorKey: MessageBox MB_OK|MB_ICONEXCLAMATION "Could not delete the registry key:$\r$\rHKLM - SOFTWARE\ODBC\ODBC.INI\$R0$\r$\rPlease delete this registry key manually !" DeleteValue: ClearErrors DeleteRegValue HKEY_LOCAL_MACHINE "SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources" "$R0" IfErrors ErrorValue Done ErrorValue: MessageBox MB_OK|MB_ICONEXCLAMATION "Could not delete the registry value:$\r$\rHKLM - SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources\$R0$\r$\rPlease delete this registry value manually !" Done: ; Restore R0-R1 Pop $R1 Pop $R0 !macroend Function DeleteODBCEntry !insertmacro DeleteODBCEntryMacro "" FunctionEnd Function un.DeleteODBCEntry !insertmacro DeleteODBCEntryMacro "un." FunctionEnd