5
5
using System . Linq ;
6
6
using System . Reflection ;
7
7
using System . Runtime . InteropServices ;
8
+ using System . Threading . Tasks ;
8
9
using System . Windows . Forms ;
9
10
10
11
namespace utPLSQL
@@ -206,7 +207,7 @@ public static void OnMenuClick(int index)
206
207
{
207
208
if ( index == PluginMenuIndexAllTests )
208
209
{
209
- if ( connected ( ) )
210
+ if ( connected ( ) && ! Sydba ( ) )
210
211
{
211
212
var testResultWindow = new TestRunnerWindow ( _plugin , username , password , database , connectAs ) ;
212
213
Windows . Add ( testResultWindow ) ;
@@ -215,7 +216,7 @@ public static void OnMenuClick(int index)
215
216
}
216
217
else if ( index == PluginMenuIndexAllTestsWithCoverage )
217
218
{
218
- if ( connected ( ) )
219
+ if ( connected ( ) && ! Sydba ( ) )
219
220
{
220
221
var testResultWindow = new TestRunnerWindow ( _plugin , username , password , database , connectAs ) ;
221
222
Windows . Add ( testResultWindow ) ;
@@ -224,7 +225,7 @@ public static void OnMenuClick(int index)
224
225
}
225
226
else if ( index == PluginPopupIndex )
226
227
{
227
- if ( connected ( ) )
228
+ if ( connected ( ) && ! Sydba ( ) )
228
229
{
229
230
getPopupObject ( out IntPtr type , out IntPtr owner , out IntPtr name , out IntPtr subType ) ;
230
231
@@ -236,7 +237,7 @@ public static void OnMenuClick(int index)
236
237
}
237
238
else if ( index == PluginPopupIndexWithCoverage )
238
239
{
239
- if ( connected ( ) )
240
+ if ( connected ( ) && ! Sydba ( ) )
240
241
{
241
242
getPopupObject ( out IntPtr type , out IntPtr owner , out IntPtr name , out IntPtr subType ) ;
242
243
@@ -262,6 +263,14 @@ public void OpenPackageBody(string owner, string name)
262
263
var source = getObjectSource ( "PACKAGE BODY" , owner , name ) ;
263
264
createWindow ( 3 , Marshal . PtrToStringAnsi ( source ) , false ) ;
264
265
}
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
+ }
265
274
266
275
private static void ConnectToDatabase ( )
267
276
{
0 commit comments