Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9f0318f

Browse files
committed
Fixes#8 and#9 Set ORACLE_HOME if not set on system level.
1 parentb2c5788 commit9f0318f

File tree

3 files changed

+41
-16
lines changed

3 files changed

+41
-16
lines changed

‎PlsqlDeveloperUtPlsqlPlugin/PlsqlDeveloperUtPlsqlPlugin/PlsqlDeveloperUtPlsqlPlugin.cs

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
namespaceutPLSQL
1212
{
13+
//*FUNC: 4*/ extern char *(*SYS_OracleHome)();
14+
internaldelegateIntPtrSysOracleHome();
15+
1316
//*FUNC: 11*/ BOOL (*IDE_Connected)();
1417
internaldelegateboolIdeConnected();
1518

@@ -23,8 +26,7 @@ namespace utPLSQL
2326
internaldelegatevoidIdeCreatePopupItem(intid,intindex,stringname,stringobjectType);
2427

2528
//*FUNC: 74*/ int (*IDE_GetPopupObject)(char **ObjectType, char **ObjectOwner, char **ObjectName, char **SubObject);
26-
internaldelegateintIdeGetPopupObject(outIntPtrobjectType,outIntPtrobjectOwner,outIntPtrobjectName,
27-
outIntPtrsubObject);
29+
internaldelegateintIdeGetPopupObject(outIntPtrobjectType,outIntPtrobjectOwner,outIntPtrobjectName,outIntPtrsubObject);
2830

2931
//*FUNC: 79*/ char *(*IDE_GetObjectSource)(char *ObjectType, char *ObjectOwner, char *ObjectName);
3032
internaldelegateIntPtrIdeGetObjectSource(stringobjectType,stringobjectOwner,stringobjectName);
@@ -44,6 +46,8 @@ public class PlsqlDeveloperUtPlsqlPlugin
4446
privateconstintPluginPopupIndex=1;
4547
privateconstintPluginPopupIndexWithCoverage=2;
4648

49+
privatestaticSysOracleHomesysOracleHome;
50+
4751
privatestaticIdeConnectedconnected;
4852
privatestaticIdeGetConnectionInfogetConnectionInfo;
4953

@@ -59,9 +63,9 @@ public class PlsqlDeveloperUtPlsqlPlugin
5963
privatestaticstringpassword;
6064
privatestaticstringdatabase;
6165
privatestaticstringconnectAs;
66+
privatestaticstringoracleHome;
6267

6368
privatestaticPlsqlDeveloperUtPlsqlPlugin_plugin;
64-
6569
privatestaticreadonlyList<TestRunnerWindow>Windows=newList<TestRunnerWindow>();
6670

6771
#region DLL exported API
@@ -83,7 +87,7 @@ public static void OnActivate()
8387
{
8488
try
8589
{
86-
ConnectToDatabase();
90+
getDatabaseInformation();
8791

8892
// Separate streams are needed!
8993
varassembly=Assembly.GetExecutingAssembly();
@@ -150,6 +154,9 @@ public static void RegisterCallback(int index, IntPtr function)
150154
{
151155
switch(index)
152156
{
157+
case4:
158+
sysOracleHome=(SysOracleHome)Marshal.GetDelegateForFunctionPointer(function,typeof(SysOracleHome));
159+
break;
153160
case11:
154161
connected=(IdeConnected)Marshal.GetDelegateForFunctionPointer(function,typeof(IdeConnected));
155162
break;
@@ -181,7 +188,7 @@ public static void RegisterCallback(int index, IntPtr function)
181188
[DllExport("OnConnectionChange",CallingConvention=CallingConvention.Cdecl)]
182189
publicstaticvoidOnConnectionChange()
183190
{
184-
ConnectToDatabase();
191+
getDatabaseInformation();
185192
}
186193

187194
[DllExport("CreateMenuItem",CallingConvention=CallingConvention.Cdecl)]
@@ -211,7 +218,7 @@ public static void OnMenuClick(int index)
211218
{
212219
if(isConnected()&&!isSydba())
213220
{
214-
vartestResultWindow=newTestRunnerWindow(_plugin,username,password,database,connectAs);
221+
vartestResultWindow=newTestRunnerWindow(_plugin,username,password,database,connectAs,oracleHome);
215222
Windows.Add(testResultWindow);
216223
testResultWindow.RunTestsAsync("_ALL",username,null,null,false);
217224
}
@@ -220,7 +227,7 @@ public static void OnMenuClick(int index)
220227
{
221228
if(isConnected()&&!isSydba())
222229
{
223-
vartestResultWindow=newTestRunnerWindow(_plugin,username,password,database,connectAs);
230+
vartestResultWindow=newTestRunnerWindow(_plugin,username,password,database,connectAs,oracleHome);
224231
Windows.Add(testResultWindow);
225232
testResultWindow.RunTestsAsync("_ALL",username,null,null,true);
226233
}
@@ -231,7 +238,7 @@ public static void OnMenuClick(int index)
231238
{
232239
getPopupObject(outIntPtrtype,outIntPtrowner,outIntPtrname,outIntPtrsubType);
233240

234-
vartestResultWindow=newTestRunnerWindow(_plugin,username,password,database,connectAs);
241+
vartestResultWindow=newTestRunnerWindow(_plugin,username,password,database,connectAs,oracleHome);
235242
Windows.Add(testResultWindow);
236243
testResultWindow.RunTestsAsync(Marshal.PtrToStringAnsi(type),Marshal.PtrToStringAnsi(owner),
237244
Marshal.PtrToStringAnsi(name),Marshal.PtrToStringAnsi(subType),false);
@@ -243,7 +250,7 @@ public static void OnMenuClick(int index)
243250
{
244251
getPopupObject(outIntPtrtype,outIntPtrowner,outIntPtrname,outIntPtrsubType);
245252

246-
vartestResultWindow=newTestRunnerWindow(_plugin,username,password,database,connectAs);
253+
vartestResultWindow=newTestRunnerWindow(_plugin,username,password,database,connectAs,oracleHome);
247254
Windows.Add(testResultWindow);
248255
testResultWindow.RunTestsAsync(Marshal.PtrToStringAnsi(type),Marshal.PtrToStringAnsi(owner),
249256
Marshal.PtrToStringAnsi(name),Marshal.PtrToStringAnsi(subType),true);
@@ -290,7 +297,7 @@ private static bool isConnected()
290297
returntrue;
291298
}
292299

293-
privatestaticvoidConnectToDatabase()
300+
privatestaticvoidgetDatabaseInformation()
294301
{
295302
try
296303
{
@@ -305,6 +312,10 @@ private static void ConnectToDatabase()
305312
IntPtrptrConnectAs=getConnectAs();
306313

307314
connectAs=Marshal.PtrToStringAnsi(ptrConnectAs);
315+
316+
IntPtrptrOracleHome=sysOracleHome();
317+
318+
oracleHome=Marshal.PtrToStringAnsi(ptrOracleHome);
308319
}
309320
}
310321
catch(Exceptione)

‎PlsqlDeveloperUtPlsqlPlugin/utPLSQL.UI.Standalone/LoginForm.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ public LoginForm()
1212

1313
privatevoidBtnRunTests_Click(objectsender,EventArgse)
1414
{
15-
vartestRunnerWindow=newTestRunnerWindow(null,txtUsername.Text,txtPassword.Text,txtDatabase.Text,null);
15+
vartestRunnerWindow=newTestRunnerWindow(null,txtUsername.Text,txtPassword.Text,txtDatabase.Text,null,null);
1616
testRunnerWindow.RunTestsAsync("USER",null,txtUsername.Text,null,false);
1717
}
1818

1919
privatevoidbtnCodeCoverage_Click(objectsender,EventArgse)
2020
{
21-
vartestRunnerWindow=newTestRunnerWindow(null,txtUsername.Text,txtPassword.Text,txtDatabase.Text,null);
21+
vartestRunnerWindow=newTestRunnerWindow(null,txtUsername.Text,txtPassword.Text,txtDatabase.Text,null,null);
2222
testRunnerWindow.RunTestsAsync("USER",null,txtUsername.Text,null,true);
2323
}
2424
}

‎PlsqlDeveloperUtPlsqlPlugin/utPLSQL.UI/TestRunnerWindow.cs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public partial class TestRunnerWindow : Form
2828
privatereadonlystringpassword;
2929
privatereadonlystringdatabase;
3030
privatereadonlystringconnectAs;
31+
privatereadonlystringoracleHome;
3132

3233
privatereadonlyList<TestResult>testResults=newList<TestResult>();
3334

@@ -39,13 +40,14 @@ public partial class TestRunnerWindow : Form
3940
privateintrowIndexOnRightClick;
4041
privateintcompletedTests;
4142

42-
publicTestRunnerWindow(objectpluginIntegration,stringusername,stringpassword,stringdatabase,stringconnectAs)
43+
publicTestRunnerWindow(objectpluginIntegration,stringusername,stringpassword,stringdatabase,stringconnectAs,stringoracleHome)
4344
{
4445
this.pluginIntegration=pluginIntegration;
4546
this.username=username;
4647
this.password=password;
4748
this.database=database;
4849
this.connectAs=connectAs;
50+
this.oracleHome=oracleHome;
4951

5052
InitializeComponent();
5153
}
@@ -72,8 +74,20 @@ public async Task RunTestsAsync(string type, string owner, string name, string p
7274
SetWindowTitle(type,owner,name,procedure);
7375

7476
testRunner=newRealTimeTestRunner();
75-
testRunner.Connect(username,password,database);
7677

78+
try
79+
{
80+
if(oracleHome!=null)
81+
{
82+
Environment.SetEnvironmentVariable("ORACLE_HOME",oracleHome);
83+
}
84+
testRunner.Connect(username,password,database);
85+
}
86+
catch(Exceptione)
87+
{
88+
MessageBox.Show(e.Message,"Connect failed",MessageBoxButtons.OK,MessageBoxIcon.Error);
89+
return;
90+
}
7791
try
7892
{
7993
testRunner.GetVersion();
@@ -599,15 +613,15 @@ private async void menuItemRunTests_ClickAsync(object sender, EventArgs e)
599613
{
600614
vartestResult=testResults[rowIndexOnRightClick];
601615

602-
vartestResultWindow=newTestRunnerWindow(pluginIntegration,username,password,database,connectAs);
616+
vartestResultWindow=newTestRunnerWindow(pluginIntegration,username,password,database,connectAs,oracleHome);
603617
awaittestResultWindow.RunTestsAsync("PROCEDURE",testResult.Owner,testResult.Package,testResult.Procedure,false);
604618
}
605619

606620
privateasyncvoidmenuItemCoverage_ClickAsync(objectsender,EventArgse)
607621
{
608622
vartestResult=testResults[rowIndexOnRightClick];
609623

610-
vartestResultWindow=newTestRunnerWindow(pluginIntegration,username,password,database,connectAs);
624+
vartestResultWindow=newTestRunnerWindow(pluginIntegration,username,password,database,connectAs,oracleHome);
611625
awaittestResultWindow.RunTestsAsync("PROCEDURE",testResult.Owner,testResult.Package,testResult.Procedure,true);
612626
}
613627

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp