55using System . Linq ;
66using System . Reflection ;
77using System . Runtime . InteropServices ;
8+ using System . Threading . Tasks ;
89using System . Windows . Forms ;
910
1011namespace utPLSQL
@@ -206,7 +207,7 @@ public static void OnMenuClick(int index)
206207 {
207208 if ( index == PluginMenuIndexAllTests )
208209 {
209- if ( connected ( ) )
210+ if ( connected ( ) && ! Sydba ( ) )
210211 {
211212 var testResultWindow = new TestRunnerWindow ( _plugin , username , password , database , connectAs ) ;
212213 Windows . Add ( testResultWindow ) ;
@@ -215,7 +216,7 @@ public static void OnMenuClick(int index)
215216 }
216217 else if ( index == PluginMenuIndexAllTestsWithCoverage )
217218 {
218- if ( connected ( ) )
219+ if ( connected ( ) && ! Sydba ( ) )
219220 {
220221 var testResultWindow = new TestRunnerWindow ( _plugin , username , password , database , connectAs ) ;
221222 Windows . Add ( testResultWindow ) ;
@@ -224,7 +225,7 @@ public static void OnMenuClick(int index)
224225 }
225226 else if ( index == PluginPopupIndex )
226227 {
227- if ( connected ( ) )
228+ if ( connected ( ) && ! Sydba ( ) )
228229 {
229230 getPopupObject ( out IntPtr type , out IntPtr owner , out IntPtr name , out IntPtr subType ) ;
230231
@@ -236,7 +237,7 @@ public static void OnMenuClick(int index)
236237 }
237238 else if ( index == PluginPopupIndexWithCoverage )
238239 {
239- if ( connected ( ) )
240+ if ( connected ( ) && ! Sydba ( ) )
240241 {
241242 getPopupObject ( out IntPtr type , out IntPtr owner , out IntPtr name , out IntPtr subType ) ;
242243
@@ -262,6 +263,14 @@ public void OpenPackageBody(string owner, string name)
262263 var source = getObjectSource ( "PACKAGE BODY" , owner , name ) ;
263264 createWindow ( 3 , Marshal . PtrToStringAnsi ( source ) , false ) ;
264265 }
266+ private static bool Sydba ( )
267+ {
268+ if ( connectAs . ToLower ( ) . Equals ( "sysdba" ) ) {
269+ MessageBox . Show ( "You shouldn't run utPLSQL as SYSDBA.\n \n Test will not run." , "Connected as SYSDBA" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
270+ return true ;
271+ }
272+ return true ;
273+ }
265274
266275 private static void ConnectToDatabase ( )
267276 {
0 commit comments