· 6 years ago · Jul 04, 2019, 05:46 AM
1using System;
2using RGiesecke.DllExport;
3using System.Runtime.InteropServices;
4
5namespace PLSQLDevWrapper
6{
7 //public interface IPLSQLDevWrapper
8 //{
9 // void OnMenuClick(int Index);
10
11 //}
12
13
14 //public abstract class PLSQLProxy
15 //{
16 // virtual public void OnMenuClick(int Index)
17 // {
18 // }
19 // virtual public void OnCreate()
20 // {
21 // return;
22 // }
23 // virtual public void OnActivate()
24 // {
25 // }
26 // virtual public void OnDeactivate()
27 // {
28 // }
29 // virtual public bool CanClose()
30 // {
31 // return true;
32 // }
33 // virtual public void AfterStart()
34 // {
35 // }
36 // virtual public void OnBrowserChange()
37 // {
38 // }
39 // virtual public void OnWindowChange()
40 // {
41 // }
42 // virtual public void OnWindowCreate(int WindowType)
43 // {
44 // }
45 // virtual public void OnWindowCreated(int WindowType)
46 // {
47 // }
48 // virtual public int OnWindowClose(int WindowType, bool Changed)
49 // {
50 // return -1;
51 // }
52 // virtual public bool BeforeExecuteWindow(int WindowType)
53 // {
54 // return false;
55 // }
56 // virtual public void AfterExecuteWindow(int WindowType, int Result)
57 // {
58 // }
59 // virtual public void OnConnectionChange()
60 // {
61 // }
62 // virtual public void OnWindowConnectionChange()
63 // {
64 // }
65 // virtual public void OnPopup(string ObjectType, string ObjectName)
66 // {
67 // }
68 // virtual public void OnMainMenu(string MenuName)
69 // {
70 // }
71 // virtual public bool OnTemplate(string Filename, out string Data)
72 // {
73 // Data = "";
74 // return false;
75 // }
76 // virtual public void OnFileLoaded(int WindowType, int Mode)
77 // {
78 // }
79 // virtual public void OnFileSaved(int WindowType, int Mode)
80 // {
81 // }
82 // virtual public string About()
83 // {
84 // return "Proxy DLL für PLSQL Developer";
85 // }
86 // virtual public void Configure()
87 // {
88 // }
89 // virtual public void CommandLine(int FeedbackHandle, string Command, string Params)
90 // {
91 // }
92 // virtual public string PlugInName()
93 // {
94 // return "PlugInName";
95 // }
96 // virtual public string PlugInSubName()
97 // {
98 // return PlugInName();
99 // }
100 // virtual public string PlugInShortName()
101 // {
102 // return "PlugInShortName";
103 // }
104 // virtual public string DirectFileLoad()
105 // {
106 // return "";
107 // }
108 // virtual public bool DirectFileSave()
109 // {
110 // return false;
111 // }
112 // virtual public string RegisterExport()
113 // {
114 // return "";
115 // }
116 // virtual public bool ExportInit()
117 // {
118 // return false;
119 // }
120 // virtual public void ExportFinished()
121 // {
122 // }
123 // virtual public bool ExportPrepare()
124 // {
125 // return false;
126 // }
127 // virtual public bool ExportData(string Value)
128 // {
129 // return false;
130 // }
131 //}
132
133 public class CSharpPLugIn
134 {
135 private SYS _SysFunc;
136 private IDE _IdeFunc;
137 private SQL _SqlFunc;
138 private string _pluginname;
139
140 public SYS SysFunc
141 {
142 get { return this._SysFunc; }
143 }
144 public IDE IdeFunc
145 {
146 get { return this._IdeFunc; }
147 }
148 public SQL SqlFunc
149 {
150 get { return this.SqlFunc; }
151
152 }
153
154 public string PlugInName
155 {
156 get { return this._pluginname; }
157
158 }
159
160 public CSharpPLugIn(string PlugInName)
161 {
162 this._pluginname = PlugInName;
163 this._SysFunc = new SYS();
164 this._IdeFunc = new IDE();
165 this._SqlFunc = new SQL();
166 }
167
168 [DllExport("RegisterCallback", CallingConvention = CallingConvention.Cdecl)]
169 public static void RegisterCallback(int index, IntPtr function)
170 {
171
172 if (Enum.IsDefined(typeof(SYS.SysType), index))
173 {
174 SYS.RegisterCallback((SYS.SysType)index, function);
175 }
176 else if (Enum.IsDefined(typeof(SQL.SqlType), index))
177 {
178 SQL.RegisterCallback((SQL.SqlType)index, function);
179 }
180 else if (Enum.IsDefined(typeof(IDE.IdeType), index))
181 {
182 IDE.RegisterCallback((IDE.IdeType)index, function);
183 }
184 }
185
186 public class SYS
187 {
188 public enum SysType
189 {
190 VERSION = 1,
191 REGISTRY = 2,
192 ROOTDIR = 3,
193 ORACLEHOME = 4,
194 OCIDLL = 5,
195 OCI8MODE = 6,
196 XPSTYLE = 7,
197 TNSNAMES = 8,
198 DELPHIVERSION = 9
199 };
200
201 #region Delegates
202 private delegate int VERSION_DELEGATE();
203 private delegate IntPtr REGISTRY_DELEGATE();
204 private delegate IntPtr ROOTDIR_DELEGATE();
205 private delegate IntPtr ORACLEHOME_DELEGATE();
206 private delegate IntPtr OCIDLL_DELEGATE();
207 [return: MarshalAs(UnmanagedType.Bool)]
208 private delegate bool OCI8MODE_DELEGATE();
209 [return: MarshalAs(UnmanagedType.Bool)]
210 private delegate bool XPSTYLE_DELEGATE();
211 private delegate IntPtr TNSNAMES_DELEGATE(string Param);
212 private delegate int DELPHIVERSION_DELEGATE();
213 #endregion
214
215 #region var
216 private static VERSION_DELEGATE _SYS_VERSION;
217 private static REGISTRY_DELEGATE _SYS_REGISTRY;
218 private static ROOTDIR_DELEGATE _SYS_ROOTDIR;
219 private static ORACLEHOME_DELEGATE _SYS_ORACLEHOME;
220 private static OCIDLL_DELEGATE _SYS_OCIDLL;
221 private static OCI8MODE_DELEGATE _SYS_OCI8MODE;
222 private static XPSTYLE_DELEGATE _SYS_XPSTYLE;
223 private static TNSNAMES_DELEGATE _SYS_TNSNAMES;
224 private static DELPHIVERSION_DELEGATE _SYS_DELPHIVERSION;
225
226 #endregion
227
228 #region methods
229 /// <summary>
230 /// Returns the PL/SQL Developer main and subversion, for example 210 for version 2.1.0.
231 /// This might be useful if you want to use functions that are not available in all versions.
232 /// </summary>
233 public int Version()
234 {
235 return _SYS_VERSION();
236 }
237
238 /// <summary>
239 /// Returns the registry root name of PL/SQL Developer in HKEY_CURRENT_USER (usually “Software\PL/SQL Developer”).
240 /// If you want to save your settings in the registry, you can create a section within the PL/SQL Developer section.
241 /// Note: In PL/SQL Developer 3.1, the registry section is moved to: (“Software\Allround Automations\PL/SQL Developer”)
242 /// </summary>
243 public string Registry()
244 {
245 return Marshal.PtrToStringAnsi(_SYS_REGISTRY());
246 }
247
248 /// <summary>
249 /// The directory where PL/SQL Developer is installed, for example “C:\Program Files\PLSQL Developer”.
250 /// </summary>
251 public string RootDir()
252 {
253 return Marshal.PtrToStringAnsi(_SYS_ROOTDIR());
254 }
255
256 /// <summary>
257 /// The Oracle directory, for example “C:\Orawin95”
258 /// </summary>
259 public string OracleHome()
260 {
261 return Marshal.PtrToStringAnsi(_SYS_ORACLEHOME());
262 }
263
264 /// <summary>
265 /// Returns the path of the OCI DLL that is used by PL/SQL Developer. If you want to initialize a new session,
266 /// you might want to use this value if you want to make sure you’re using the same OCI version.
267 /// Available in version 300
268 /// </summary>
269 public string OCIDLL()
270 {
271 return Marshal.PtrToStringAnsi(_SYS_OCIDLL());
272 }
273
274 /// <summary>
275 /// Returns True if PL/SQL Developer is currently connected in OCI8 Mode (Net8). Available in version 300
276 /// </summary>
277 public bool OCI8Mode()
278 {
279 return _SYS_OCI8MODE();
280 }
281
282 /// <summary>
283 /// Returns if PL/SQL Developer is currently using the visual XP style. Available in version 700
284 /// </summary>
285 public bool XPStyle()
286 {
287 return _SYS_XPSTYLE();
288 }
289
290 /// <summary>
291 /// If Param is empty, the function will return the full tnsnames filename.
292 /// If Param has a value, the connection details of the alias as specified by Param is returned.
293 /// If Param is *, the connection details of the current connection are returned).
294 /// </summary>
295 public string TNSNAMES(string Param)
296 {
297 return Marshal.PtrToStringAnsi(_SYS_TNSNAMES(Param));
298 }
299
300 /// <summary>
301 /// Returns the Delphi version used to build PL/SQL Developer. Only useful for very specific functions.
302 /// </summary>
303 public int DelphiVersion()
304 {
305 return _SYS_DELPHIVERSION();
306 }
307 #endregion
308
309 /// <summary>
310 /// Call Back Funktionen für SYS
311 /// </summary> <param name="index"></param> <param name="function"></param>
312 public static void RegisterCallback(SysType index, IntPtr function)
313 {
314 switch (index)
315 {
316 case SysType.VERSION:
317 _SYS_VERSION = (VERSION_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(VERSION_DELEGATE));
318 break;
319 case SysType.REGISTRY:
320 _SYS_REGISTRY = (REGISTRY_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(REGISTRY_DELEGATE));
321 break;
322 case SysType.ROOTDIR:
323 _SYS_ROOTDIR = (ROOTDIR_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(ROOTDIR_DELEGATE));
324 break;
325 case SysType.ORACLEHOME:
326 _SYS_ORACLEHOME = (ORACLEHOME_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(ORACLEHOME_DELEGATE));
327 break;
328 case SysType.OCIDLL:
329 _SYS_OCIDLL = (OCIDLL_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(OCIDLL_DELEGATE));
330 break;
331 case SysType.OCI8MODE:
332 _SYS_OCI8MODE = (OCI8MODE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(OCI8MODE_DELEGATE));
333 break;
334 case SysType.XPSTYLE:
335 _SYS_XPSTYLE = (XPSTYLE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(XPSTYLE_DELEGATE));
336 break;
337 case SysType.TNSNAMES:
338 _SYS_TNSNAMES = (TNSNAMES_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(TNSNAMES_DELEGATE));
339 break;
340 case SysType.DELPHIVERSION:
341 _SYS_DELPHIVERSION = (DELPHIVERSION_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(DELPHIVERSION_DELEGATE));
342 break;
343 }
344 }
345 }
346
347 public class IDE
348 {
349 public enum IdeType
350 {
351 MENUSTATE = 10,
352 CONNECTED = 11,
353 GETCONNECTIONINFO = 12,
354 GETBROWSERINFO = 13,
355 GETWINDOWTYPE = 14,
356 GETAPPHANDLE = 15,
357 GETWINDOWHANDLE = 16,
358 GETCLIENTHANDLE = 17,
359 GETCHILDHANDLE = 18,
360 REFRESH = 19,
361 CREATEWINDOW = 20,
362 OPENFILE = 21,
363 SAVEFILE = 22,
364 FILENAME = 23,
365 CLOSEFILE = 24,
366 SETREADONLY = 25,
367 GETREADONLY = 26,
368 EXECUTESQLREPORT = 27,
369 RELOADFILE = 28,
370 SETFILENAME = 29,
371 GETTEXT = 30,
372 GETSELECTEDTEXT = 31,
373 GETCURSORWORD = 32,
374 GETEDITORHANDLE = 33,
375 SETTEXT = 34,
376 SETSTATUSMESSAGE = 35,
377 SETERRORPOSITION = 36,
378 CLEARERRORPOSITIONS = 37,
379 GETCURSORWORDPOSITION = 38,
380 PERFORM = 39,
381 GETCUSTOMKEYWORDS = 60,
382 SETCUSTOMKEYWORDS = 61,
383 SETKEYWORDS = 62,
384 ACTIVATEKEYWORDS = 63,
385 REFRESHMENUS = 64,
386 SETMENUNAME = 65,
387 SETMENUCHECK = 66,
388 SETMENUVISIBLE = 67,
389 GETMENULAYOUT = 68,
390 CREATEPOPUPITEM = 69,
391 SETCONNECTION = 70,
392 GETOBJECTINFO = 71,
393 GETBROWSERITEMS = 72,
394 REFRESHBROWSER = 73,
395 GETPOPUPOBJECT = 74,
396 GETPOPUPBROWSERROOT = 75,
397 REFRESHOBJECT = 76,
398 FIRSTSELECTEDOBJECT = 77,
399 NEXTSELECTEDOBJECT = 78,
400 GETOBJECTSOURCE = 79,
401 GETWINDOWCOUNT = 80,
402 SELECTWINDOW = 81,
403 ACTIVATEWINDOW = 82,
404 WINDOWISMODIFIED = 83,
405 WINDOWISRUNNING = 84,
406 WINDOWPIN = 85,
407 SPLASHCREATE = 90,
408 SPLASHHIDE = 91,
409 SPLASHWRITE = 92,
410 SPLASHWRITELN = 93,
411 SPLASHPROGRESS = 94,
412 TEMPLATEPATH = 95,
413 EXECUTETEMPLATE = 96,
414 GETCONNECTAS = 97,
415 SETCONNECTIONAS = 98,
416 GETFILEOPENMENU = 100,
417 CANSAVEWINDOW = 101,
418 OPENFILEEXTERNAL = 102,
419 GETFILETYPES = 103,
420 GETDEFAULTEXTENSION = 104,
421 GETFILEDATA = 105,
422 FILESAVED = 106,
423 SHOWHTML = 107,
424 REFRESHHTML = 108,
425 GETPROCEDITEXTENSION = 109,
426 GETWINDOWOBJECT = 110,
427 FIRSTSELECTEDFILE = 111,
428 NEXTSELECTEDFILE = 112,
429 REFRESHFILEBROWSER = 113,
430 KEYPRESS = 120,
431 GETMENUITEM = 121,
432 SELECTMENU = 122,
433 TRANSLATIONFILE = 130,
434 TRANSLATIONLANGUAGE = 131,
435 GETTRANSLATEDMENULAYOUT = 132,
436 MAINFONT = 133,
437 TRANSLATEITEMS = 134,
438 TRANSLATESTRING = 135,
439 SAVERECOVERYFILES = 140,
440 GETCURSORX = 141,
441 GETCURSORY = 142,
442 SETCURSOR = 143,
443 SETBOOKMARK = 144,
444 CLEARBOOKMARK = 145,
445 GOTOBOOKMARK = 146,
446 GETBOOKMARK = 147,
447 TABINFO = 148,
448 TABINDEX = 149,
449 CREATETOOLBUTTON = 150,
450 WINDOWHASEDITOR = 153,
451 BEAUTIFIEROPTIONS = 160,
452 BEAUTIFYWINDOW = 161,
453 BEAUTIFYTEXT = 162,
454 OBJECTACTION = 165,
455 SHOWDIALOG = 166,
456 DEBUGLOG = 173,
457 GETPARAMSTRING = 174,
458 GETPARAMBOOL = 175,
459 GETBROWSERFILTER = 176,
460 COMMANDFEEDBACK = 180,
461 RESULTGRIDROWCOUNT = 190,
462 RESULTGRIDCOLCOUNT = 191,
463 RESULTGRIDCELL = 192,
464 AUTHORIZED = 200,
465 WINDOWALLOWED = 201,
466 AUTHORIZATION = 202,
467 AUTHORIZATIONITEMS = 203,
468 ADDAUTHORIZATIONITEM = 204,
469 GETPERSONALPREFSETS = 210,
470 GETDEFAULTPREFSETS = 211,
471 GETPREFASSTRING = 212,
472 GETPREFASINTEGER = 213,
473 GETPREFASBOOL = 214,
474 SETPREFASSTRING = 215,
475 SETPREFASINTEGER = 216,
476 SETPREFASBOOL = 217,
477 GETGENERALPREF = 218,
478 PLUGINSETTING = 219,
479 GETPROCOVERLOADCOUNT = 220,
480 SELECTPROCOVERLOADING = 221,
481 GETSESSIONVALUE = 230,
482 CHECKDBVERSION = 231,
483 GETCONNECTIONINFOEX = 240,
484 FINDCONNECTION = 241,
485 ADDCONNECTION = 242,
486 CONNECTCONNECTION = 243,
487 SETMAINCONNECTION = 244,
488 GETWINDOWCONNECTION = 245,
489 SETWINDOWCONNECTION = 246,
490 GETCONNECTIONTREE = 247,
491 GETCONNECTIONINFOEX10 = 250,
492 FINDCONNECTIONEX10 = 251,
493 ADDCONNECTIONEX10 = 252,
494 GETCONNECTIONTREEEX10 = 253
495 }
496
497 #region Delegates
498 private delegate void MENUSTATE_DELEGATE(int ID, int Index, [MarshalAs(UnmanagedType.Bool)] bool Enabled);
499 [return: MarshalAs(UnmanagedType.Bool)]
500 private delegate bool CONNECTED_DELEGATE();
501 private delegate void GETCONNECTIONINFO_DELEGATE(out IntPtr Username, out IntPtr Password, out IntPtr Database);
502 private delegate void GETBROWSERINFO_DELEGATE(out IntPtr ObjectType, out IntPtr ObjectOwner, out IntPtr ObjectName);
503 private delegate int GETWINDOWTYPE_DELEGATE();
504 private delegate int GETAPPHANDLE_DELEGATE();
505 private delegate int GETWINDOWHANDLE_DELEGATE();
506 private delegate int GETCLIENTHANDLE_DELEGATE();
507 private delegate int GETCHILDHANDLE_DELEGATE();
508 private delegate void REFRESH_DELEGATE();
509 private delegate void CREATEWINDOW_DELEGATE(int WindowType, string Text, [MarshalAs(UnmanagedType.Bool)] bool Execute);
510 [return: MarshalAs(UnmanagedType.Bool)]
511 private delegate bool OPENFILE_DELEGATE(int WindowType, string Filename);
512 [return: MarshalAs(UnmanagedType.Bool)]
513 private delegate bool SAVEFILE_DELEGATE();
514 private delegate IntPtr FILENAME_DELEGATE();
515 private delegate void CLOSEFILE_DELEGATE();
516 private delegate void SETREADONLY_DELEGATE([MarshalAs(UnmanagedType.Bool)] bool ReadOnly);
517 [return: MarshalAs(UnmanagedType.Bool)]
518 private delegate bool GETREADONLY_DELEGATE();
519 [return: MarshalAs(UnmanagedType.Bool)]
520 private delegate bool EXECUTESQLREPORT_DELEGATE(string SQL, string Title, [MarshalAs(UnmanagedType.Bool)] bool Updateable);
521 [return: MarshalAs(UnmanagedType.Bool)]
522 private delegate bool RELOADFILE_DELEGATE();
523 private delegate void SETFILENAME_DELEGATE(string Filename);
524 private delegate IntPtr GETTEXT_DELEGATE();
525 private delegate IntPtr GETSELECTEDTEXT_DELEGATE();
526 private delegate IntPtr GETCURSORWORD_DELEGATE();
527 private delegate int GETEDITORHANDLE_DELEGATE();
528 [return: MarshalAs(UnmanagedType.Bool)]
529 private delegate bool SETTEXT_DELEGATE(string Text);
530 [return: MarshalAs(UnmanagedType.Bool)]
531 private delegate bool SETSTATUSMESSAGE_DELEGATE(string Text);
532 [return: MarshalAs(UnmanagedType.Bool)]
533 private delegate bool SETERRORPOSITION_DELEGATE(int Line, int Col);
534 private delegate void CLEARERRORPOSITIONS_DELEGATE();
535 private delegate int GETCURSORWORDPOSITION_DELEGATE();
536 [return: MarshalAs(UnmanagedType.Bool)]
537 private delegate bool PERFORM_DELEGATE(int Param);
538 private delegate IntPtr GETCUSTOMKEYWORDS_DELEGATE();
539 private delegate void SETCUSTOMKEYWORDS_DELEGATE(string Keywords);
540 private delegate void SETKEYWORDS_DELEGATE(int ID, int Style, string Keywords);
541 private delegate void ACTIVATEKEYWORDS_DELEGATE();
542 private delegate void REFRESHMENUS_DELEGATE(int ID);
543 private delegate void SETMENUNAME_DELEGATE(int ID, int Index, string Name);
544 private delegate void SETMENUCHECK_DELEGATE(int ID, int Index, [MarshalAs(UnmanagedType.Bool)] bool Enabled);
545 private delegate void SETMENUVISIBLE_DELEGATE(int ID, int Index, [MarshalAs(UnmanagedType.Bool)] bool Enabled);
546 private delegate IntPtr GETMENULAYOUT_DELEGATE();
547 private delegate void CREATEPOPUPITEM_DELEGATE(int ID, int Index, string Name, string ObjectType);
548 [return: MarshalAs(UnmanagedType.Bool)]
549 private delegate bool SETCONNECTION_DELEGATE(string Username, string Password, string Database);
550 private delegate int GETOBJECTINFO_DELEGATE(string AnObject, out IntPtr ObjectType, out IntPtr ObjectOwner, out IntPtr ObjectName, out IntPtr SubObject);
551 private delegate IntPtr GETBROWSERITEMS_DELEGATE(string Node, [MarshalAs(UnmanagedType.Bool)] bool GetItems);
552 private delegate void REFRESHBROWSER_DELEGATE(string Node);
553 private delegate int GETPOPUPOBJECT_DELEGATE(out IntPtr ObjectType, out IntPtr ObjectOwner, out IntPtr ObjectName, out IntPtr SubObject);
554 private delegate IntPtr GETPOPUPBROWSERROOT_DELEGATE();
555 private delegate void REFRESHOBJECT_DELEGATE(string ObjectType, string ObjectOwner, string ObjectName, int Action);
556 [return: MarshalAs(UnmanagedType.Bool)]
557 private delegate bool FIRSTSELECTEDOBJECT_DELEGATE(string ObjectType, string ObjectOwner, string ObjectName, string SubObject);
558 [return: MarshalAs(UnmanagedType.Bool)]
559 private delegate bool NEXTSELECTEDOBJECT_DELEGATE(string ObjectType, string ObjectOwner, string ObjectName, string SubObject);
560 private delegate IntPtr GETOBJECTSOURCE_DELEGATE(string ObjectType, string ObjectOwner, string ObjectName);
561 private delegate int GETWINDOWCOUNT_DELEGATE();
562 [return: MarshalAs(UnmanagedType.Bool)]
563 private delegate bool SELECTWINDOW_DELEGATE(int Index);
564 [return: MarshalAs(UnmanagedType.Bool)]
565 private delegate bool ACTIVATEWINDOW_DELEGATE(int Index);
566 [return: MarshalAs(UnmanagedType.Bool)]
567 private delegate bool WINDOWISMODIFIED_DELEGATE();
568 [return: MarshalAs(UnmanagedType.Bool)]
569 private delegate bool WINDOWISRUNNING_DELEGATE();
570 private delegate void SPLASHCREATE_DELEGATE(int ProgressMax);
571 private delegate void SPLASHHDELEGATE();
572 private delegate void SPLASHWRITE_DELEGATE(string s);
573 private delegate void SPLASHWRITELN_DELEGATE(string s);
574 private delegate void SPLASHPROGRESS_DELEGATE(int Progress);
575 private delegate IntPtr TEMPLATEPATH_DELEGATE();
576 [return: MarshalAs(UnmanagedType.Bool)]
577 private delegate bool EXECUTETEMPLATE_DELEGATE(string Template, [MarshalAs(UnmanagedType.Bool)] bool NewWindow);
578 private delegate IntPtr GETCONNECTAS_DELEGATE();
579 [return: MarshalAs(UnmanagedType.Bool)]
580 private delegate bool SETCONNECTIONAS_DELEGATE(string Username, string Password, string Database, string ConnectAs);
581 private delegate IntPtr GETFILEOPENMENU_DELEGATE(int MenuIndex, out int WindowType);
582 [return: MarshalAs(UnmanagedType.Bool)]
583 private delegate bool CANSAVEWINDOW_DELEGATE();
584 private delegate void OPENFILEEXTERNAL_DELEGATE(int WindowType, string Data, string FileSystem, string Tag, string Filename);
585 private delegate IntPtr GETFILETYPES_DELEGATE(int WindowType);
586 private delegate IntPtr GETDEFAULTEXTENSION_DELEGATE(int WindowType);
587 private delegate IntPtr GETFILEDATA_DELEGATE();
588 private delegate void FILESAVED_DELEGATE(string FileSystem, string FileTag, string Filename);
589 [return: MarshalAs(UnmanagedType.Bool)]
590 private delegate bool SHOWHTML_DELEGATE(string Url, string Hash, string Title, string ID);
591 [return: MarshalAs(UnmanagedType.Bool)]
592 private delegate bool REFRESHHTML_DELEGATE(string Url, string ID, [MarshalAs(UnmanagedType.Bool)] bool BringToFront);
593 private delegate IntPtr GETPROCEDITEXTENSION_DELEGATE(string oType);
594 [return: MarshalAs(UnmanagedType.Bool)]
595 private delegate bool GETWINDOWOBJECT_DELEGATE(out IntPtr ObjectType, out IntPtr ObjectOwner, out IntPtr ObjectName, out IntPtr SubObject);
596 private delegate void KEYPRESS_DELEGATE(int Key, int Shift);
597 private delegate int GETMENUITEM_DELEGATE(string MenuName);
598 [return: MarshalAs(UnmanagedType.Bool)]
599 private delegate bool SELECTMENU_DELEGATE(int MenuItem);
600 private delegate IntPtr TRANSLATIONFILE_DELEGATE();
601 private delegate IntPtr TRANSLATIONLANGUAGE_DELEGATE();
602 private delegate IntPtr GETTRANSLATEDMENULAYOUT_DELEGATE();
603 [return: MarshalAs(UnmanagedType.Bool)]
604 private delegate bool SAVERECOVERYFILES_DELEGATE();
605 private delegate int GETCURSORX_DELEGATE();
606 private delegate int GETCURSORY_DELEGATE();
607 private delegate void SETCURSOR_DELEGATE(int X, int Y);
608 private delegate int SETBOOKMARK_DELEGATE(int Index, int X, int Y);
609 private delegate void CLEARBOOKMARK_DELEGATE(int Index);
610 private delegate void GOTOBOOKMARK_DELEGATE(int Index);
611 [return: MarshalAs(UnmanagedType.Bool)]
612 private delegate bool GETBOOKMARK_DELEGATE(int Index, int X, int Y);
613 private delegate IntPtr TABINFO_DELEGATE(int Index);
614 private delegate int TABINDEX_DELEGATE(int Index);
615 private delegate void CREATETOOLBUTTON_DELEGATE(int ID, int Index, string Name, string BitmapFile, int BitmapHandle);
616 private delegate int BEAUTIFIEROPTIONS_DELEGATE();
617 [return: MarshalAs(UnmanagedType.Bool)]
618 private delegate bool BEAUTIFYWINDOW_DELEGATE();
619 private delegate IntPtr BEAUTIFYTEXT_DELEGATE(string S);
620 [return: MarshalAs(UnmanagedType.Bool)]
621 private delegate bool OBJECTACTION_DELEGATE(string Action, string ObjectType, string ObjectOwner, string ObjectName);
622 [return: MarshalAs(UnmanagedType.Bool)]
623 private delegate bool SHOWDIALOG_DELEGATE(string Dialog, string Param);
624 private delegate void DEBUGLOG_DELEGATE(string Msg);
625 private delegate IntPtr GETPARAMSTRING_DELEGATE(string Name);
626 [return: MarshalAs(UnmanagedType.Bool)]
627 private delegate bool GETPARAMBOOL_DELEGATE(string Name);
628 private delegate void COMMANDFEEDBACK_DELEGATE(int FeedbackHandle, string S);
629 private delegate int RESULTGRIDROWCOUNT_DELEGATE();
630 private delegate int RESULTGRIDCOLCOUNT_DELEGATE();
631 private delegate IntPtr RESULTGRIDCELL_DELEGATE(int Col, int Row);
632 [return: MarshalAs(UnmanagedType.Bool)]
633 private delegate bool AUTHORIZED_DELEGATE(string Category, string Name, string SubName);
634 [return: MarshalAs(UnmanagedType.Bool)]
635 private delegate bool WINDOWALLOWED_DELEGATE(int WindowType, [MarshalAs(UnmanagedType.Bool)] bool ShowErrorMessage);
636 [return: MarshalAs(UnmanagedType.Bool)]
637 private delegate bool AUTHORIZATION_DELEGATE();
638 private delegate IntPtr AUTHORIZATIONITEMS_DELEGATE(string Category);
639 private delegate void ADDAUTHORIZATIONITEM_DELEGATE(int PlugInID, string Name);
640 private delegate IntPtr GETPERSONALPREFSETS_DELEGATE();
641 private delegate IntPtr GETDEFAULTPREFSETS_DELEGATE();
642 [return: MarshalAs(UnmanagedType.Bool)]
643 private delegate bool GETPREFASSTRING_DELEGATE(int PlugInID, string PrefSet, string Name, string Default);
644 private delegate int GETPREFASINTEGER_DELEGATE(int PlugInID, string PrefSet, string Name, [MarshalAs(UnmanagedType.Bool)] bool Default);
645 [return: MarshalAs(UnmanagedType.Bool)]
646 private delegate bool GETPREFASBOOL_DELEGATE(int PlugInID, string PrefSet, string Name, [MarshalAs(UnmanagedType.Bool)] bool Default);
647 [return: MarshalAs(UnmanagedType.Bool)]
648 private delegate bool SETPREFASSTRING_DELEGATE(int PlugInID, string PrefSet, string Name, string Value);
649 [return: MarshalAs(UnmanagedType.Bool)]
650 private delegate bool SETPREFASINTEGER_DELEGATE(int PlugInID, string PrefSet, string Name, int Value);
651 [return: MarshalAs(UnmanagedType.Bool)]
652 private delegate bool SETPREFASBOOL_DELEGATE(int PlugInID, string PrefSet, string Name, [MarshalAs(UnmanagedType.Bool)] bool Value);
653 private delegate IntPtr GETGENERALPREF_DELEGATE(string Name);
654 [return: MarshalAs(UnmanagedType.Bool)]
655 private delegate bool PLUGINSETTING_DELEGATE(int PlugInID, string Setting, string Value);
656 private delegate int GETPROCOVERLOADCOUNT_DELEGATE(string Owner, string PackageName, string ProcedureName);
657 private delegate int SELECTPROCOVERLOADING_DELEGATE(string Owner, string PackageName, string ProcedureName);
658 private delegate IntPtr GETSESSIONVALUE_DELEGATE(string Name);
659 private delegate int ADDCONNECTION_DELEGATE(string Username, string Password, string Database, string ConnectAs);
660 private delegate int WINDOWPIN_DELEGATE(int Pin);
661 private delegate IntPtr FIRSTSELECTEDFILE_DELEGATE([MarshalAs(UnmanagedType.Bool)] bool Files, [MarshalAs(UnmanagedType.Bool)] bool Directories);
662 private delegate IntPtr NEXTSELECTEDFILE_DELEGATE();
663 private delegate void REFRESHFILEBROWSER_DELEGATE();
664 private delegate IntPtr MAINFONT_DELEGATE();
665 private delegate IntPtr TRANSLATEITEMS_DELEGATE(string Group);
666 private delegate IntPtr TRANSLATESTRING_DELEGATE(string ID, string Default, string Param1, string Param2);
667 [return: MarshalAs(UnmanagedType.Bool)]
668 private delegate bool WINDOWHASEDITOR_DELEGATE([MarshalAs(UnmanagedType.Bool)] bool CodeEditor);
669 private delegate void GETBROWSERFILTER_DELEGATE(int Index, out IntPtr Name, out IntPtr WhereClause, out IntPtr OrderByClause, out IntPtr User, [MarshalAs(UnmanagedType.Bool)] bool Active);
670 [return: MarshalAs(UnmanagedType.Bool)]
671 private delegate bool CHECKDBVERSION_DELEGATE(string Version);
672 [return: MarshalAs(UnmanagedType.Bool)]
673 private delegate bool GETCONNECTIONINFOEX_DELEGATE(int ix, out IntPtr Username, out IntPtr Password, out IntPtr Database, out IntPtr ConnectAs);
674 private delegate int FINDCONNECTION_DELEGATE(string Username, string Database);
675 [return: MarshalAs(UnmanagedType.Bool)]
676 private delegate bool CONNECTCONNECTION_DELEGATE(int ix);
677 [return: MarshalAs(UnmanagedType.Bool)]
678 private delegate bool SETMAINCONNECTION_DELEGATE(int ix);
679 private delegate int GETWINDOWCONNECTION_DELEGATE();
680 [return: MarshalAs(UnmanagedType.Bool)]
681 private delegate bool SETWINDOWCONNECTION_DELEGATE();
682 [return: MarshalAs(UnmanagedType.Bool)]
683 private delegate bool GETCONNECTIONTREE_DELEGATE(int ix, out IntPtr Description, out IntPtr Username, out IntPtr stringPassword, out IntPtr stringDatabase, out IntPtr stringConnectAs, int ID, int ParentID);
684 [return: MarshalAs(UnmanagedType.Bool)]
685 private delegate bool GETCONNECTIONINFOEX10_DELEGATE(int ix, out IntPtr Username, out IntPtr Password, out IntPtr Database, out IntPtr ConnectAs, out IntPtr Edition, out IntPtr Workspace);
686 private delegate int FINDCONNECTIONEX10_DELEGATE(string Username, string Database, string Edition, string Workspace);
687 private delegate int ADDCONNECTIONEX10_DELEGATE(string Username, string Password, string Database, string ConnectAs, string Edition, string Workspace);
688 [return: MarshalAs(UnmanagedType.Bool)]
689 private delegate bool GETCONNECTIONTREEEX10_DELEGATE(int ix, out IntPtr Description, out IntPtr Username, out IntPtr Password, out IntPtr Database, out IntPtr ConnectAs, out IntPtr Edition, out IntPtr Workspace, int ID, int ParentID);
690 #endregion
691
692 #region vars
693 private static MENUSTATE_DELEGATE _MENUSTATE;
694 private static CONNECTED_DELEGATE _CONNECTED;
695 private static GETCONNECTIONINFO_DELEGATE _GETCONNECTIONINFO;
696 private static GETBROWSERINFO_DELEGATE _GETBROWSERINFO;
697 private static GETWINDOWTYPE_DELEGATE _GETWINDOWTYPE;
698 private static GETAPPHANDLE_DELEGATE _GETAPPHANDLE;
699 private static GETWINDOWHANDLE_DELEGATE _GETWINDOWHANDLE;
700 private static GETCLIENTHANDLE_DELEGATE _GETCLIENTHANDLE;
701 private static GETCHILDHANDLE_DELEGATE _GETCHILDHANDLE;
702 private static REFRESH_DELEGATE _REFRESH;
703 private static CREATEWINDOW_DELEGATE _CREATEWINDOW;
704 private static OPENFILE_DELEGATE _OPENFILE;
705 private static SAVEFILE_DELEGATE _SAVEFILE;
706 private static FILENAME_DELEGATE _FILENAME;
707 private static CLOSEFILE_DELEGATE _CLOSEFILE;
708 private static SETREADONLY_DELEGATE _SETREADONLY;
709 private static GETREADONLY_DELEGATE _GETREADONLY;
710 private static EXECUTESQLREPORT_DELEGATE _EXECUTESQLREPORT;
711 private static RELOADFILE_DELEGATE _RELOADFILE;
712 private static SETFILENAME_DELEGATE _SETFILENAME;
713 private static GETTEXT_DELEGATE _GETTEXT;
714 private static GETSELECTEDTEXT_DELEGATE _GETSELECTEDTEXT;
715 private static GETCURSORWORD_DELEGATE _GETCURSORWORD;
716 private static GETEDITORHANDLE_DELEGATE _GETEDITORHANDLE;
717 private static SETTEXT_DELEGATE _SETTEXT;
718 private static SETSTATUSMESSAGE_DELEGATE _SETSTATUSMESSAGE;
719 private static SETERRORPOSITION_DELEGATE _SETERRORPOSITION;
720 private static CLEARERRORPOSITIONS_DELEGATE _CLEARERRORPOSITIONS;
721 private static GETCURSORWORDPOSITION_DELEGATE _GETCURSORWORDPOSITION;
722 private static PERFORM_DELEGATE _PERFORM;
723 private static GETCUSTOMKEYWORDS_DELEGATE _GETCUSTOMKEYWORDS;
724 private static SETCUSTOMKEYWORDS_DELEGATE _SETCUSTOMKEYWORDS;
725 private static SETKEYWORDS_DELEGATE _SETKEYWORDS;
726 private static ACTIVATEKEYWORDS_DELEGATE _ACTIVATEKEYWORDS;
727 private static REFRESHMENUS_DELEGATE _REFRESHMENUS;
728 private static SETMENUNAME_DELEGATE _SETMENUNAME;
729 private static SETMENUCHECK_DELEGATE _SETMENUCHECK;
730 private static SETMENUVISIBLE_DELEGATE _SETMENUVISIBLE;
731 private static GETMENULAYOUT_DELEGATE _GETMENULAYOUT;
732 private static CREATEPOPUPITEM_DELEGATE _CREATEPOPUPITEM;
733 private static SETCONNECTION_DELEGATE _SETCONNECTION;
734 private static GETOBJECTINFO_DELEGATE _GETOBJECTINFO;
735 private static GETBROWSERITEMS_DELEGATE _GETBROWSERITEMS;
736 private static REFRESHBROWSER_DELEGATE _REFRESHBROWSER;
737 private static GETPOPUPOBJECT_DELEGATE _GETPOPUPOBJECT;
738 private static GETPOPUPBROWSERROOT_DELEGATE _GETPOPUPBROWSERROOT;
739 private static REFRESHOBJECT_DELEGATE _REFRESHOBJECT;
740 private static FIRSTSELECTEDOBJECT_DELEGATE _FIRSTSELECTEDOBJECT;
741 private static NEXTSELECTEDOBJECT_DELEGATE _NEXTSELECTEDOBJECT;
742 private static GETOBJECTSOURCE_DELEGATE _GETOBJECTSOURCE;
743 private static GETWINDOWCOUNT_DELEGATE _GETWINDOWCOUNT;
744 private static SELECTWINDOW_DELEGATE _SELECTWINDOW;
745 private static ACTIVATEWINDOW_DELEGATE _ACTIVATEWINDOW;
746 private static WINDOWISMODIFIED_DELEGATE _WINDOWISMODIFIED;
747 private static WINDOWISRUNNING_DELEGATE _WINDOWISRUNNING;
748 private static SPLASHCREATE_DELEGATE _SPLASHCREATE;
749 private static SPLASHHDELEGATE _SPLASHHIDE;
750 private static SPLASHWRITE_DELEGATE _SPLASHWRITE;
751 private static SPLASHWRITELN_DELEGATE _SPLASHWRITELN;
752 private static SPLASHPROGRESS_DELEGATE _SPLASHPROGRESS;
753 private static TEMPLATEPATH_DELEGATE _TEMPLATEPATH;
754 private static EXECUTETEMPLATE_DELEGATE _EXECUTETEMPLATE;
755 private static GETCONNECTAS_DELEGATE _GETCONNECTAS;
756 private static SETCONNECTIONAS_DELEGATE _SETCONNECTIONAS;
757 private static GETFILEOPENMENU_DELEGATE _GETFILEOPENMENU;
758 private static CANSAVEWINDOW_DELEGATE _CANSAVEWINDOW;
759 private static OPENFILEEXTERNAL_DELEGATE _OPENFILEEXTERNAL;
760 private static GETFILETYPES_DELEGATE _GETFILETYPES;
761 private static GETDEFAULTEXTENSION_DELEGATE _GETDEFAULTEXTENSION;
762 private static GETFILEDATA_DELEGATE _GETFILEDATA;
763 private static FILESAVED_DELEGATE _FILESAVED;
764 private static SHOWHTML_DELEGATE _SHOWHTML;
765 private static REFRESHHTML_DELEGATE _REFRESHHTML;
766 private static GETPROCEDITEXTENSION_DELEGATE _GETPROCEDITEXTENSION;
767 private static GETWINDOWOBJECT_DELEGATE _GETWINDOWOBJECT;
768 private static KEYPRESS_DELEGATE _KEYPRESS;
769 private static GETMENUITEM_DELEGATE _GETMENUITEM;
770 private static SELECTMENU_DELEGATE _SELECTMENU;
771 private static TRANSLATIONFILE_DELEGATE _TRANSLATIONFILE;
772 private static TRANSLATIONLANGUAGE_DELEGATE _TRANSLATIONLANGUAGE;
773 private static GETTRANSLATEDMENULAYOUT_DELEGATE _GETTRANSLATEDMENULAYOUT;
774 private static SAVERECOVERYFILES_DELEGATE _SAVERECOVERYFILES;
775 private static GETCURSORX_DELEGATE _GETCURSORX;
776 private static GETCURSORY_DELEGATE _GETCURSORY;
777 private static SETCURSOR_DELEGATE _SETCURSOR;
778 private static SETBOOKMARK_DELEGATE _SETBOOKMARK;
779 private static CLEARBOOKMARK_DELEGATE _CLEARBOOKMARK;
780 private static GOTOBOOKMARK_DELEGATE _GOTOBOOKMARK;
781 private static GETBOOKMARK_DELEGATE _GETBOOKMARK;
782 private static TABINFO_DELEGATE _TABINFO;
783 private static TABINDEX_DELEGATE _TABINDEX;
784 private static CREATETOOLBUTTON_DELEGATE _CREATETOOLBUTTON;
785 private static BEAUTIFIEROPTIONS_DELEGATE _BEAUTIFIEROPTIONS;
786 private static BEAUTIFYWINDOW_DELEGATE _BEAUTIFYWINDOW;
787 private static BEAUTIFYTEXT_DELEGATE _BEAUTIFYTEXT;
788 private static OBJECTACTION_DELEGATE _OBJECTACTION;
789 private static SHOWDIALOG_DELEGATE _SHOWDIALOG;
790 private static DEBUGLOG_DELEGATE _DEBUGLOG;
791 private static GETPARAMSTRING_DELEGATE _GETPARAMSTRING;
792 private static GETPARAMBOOL_DELEGATE _GETPARAMBOOL;
793 private static COMMANDFEEDBACK_DELEGATE _COMMANDFEEDBACK;
794 private static RESULTGRIDROWCOUNT_DELEGATE _RESULTGRIDROWCOUNT;
795 private static RESULTGRIDCOLCOUNT_DELEGATE _RESULTGRIDCOLCOUNT;
796 private static RESULTGRIDCELL_DELEGATE _RESULTGRIDCELL;
797 private static AUTHORIZED_DELEGATE _AUTHORIZED;
798 private static WINDOWALLOWED_DELEGATE _WINDOWALLOWED;
799 private static AUTHORIZATION_DELEGATE _AUTHORIZATION;
800 private static AUTHORIZATIONITEMS_DELEGATE _AUTHORIZATIONITEMS;
801 private static ADDAUTHORIZATIONITEM_DELEGATE _ADDAUTHORIZATIONITEM;
802 private static GETPERSONALPREFSETS_DELEGATE _GETPERSONALPREFSETS;
803 private static GETDEFAULTPREFSETS_DELEGATE _GETDEFAULTPREFSETS;
804 private static GETPREFASSTRING_DELEGATE _GETPREFASSTRING;
805 private static GETPREFASINTEGER_DELEGATE _GETPREFASINTEGER;
806 private static GETPREFASBOOL_DELEGATE _GETPREFASBOOL;
807 private static SETPREFASSTRING_DELEGATE _SETPREFASSTRING;
808 private static SETPREFASINTEGER_DELEGATE _SETPREFASINTEGER;
809 private static SETPREFASBOOL_DELEGATE _SETPREFASBOOL;
810 private static GETGENERALPREF_DELEGATE _GETGENERALPREF;
811 private static PLUGINSETTING_DELEGATE _PLUGINSETTING;
812 private static GETPROCOVERLOADCOUNT_DELEGATE _GETPROCOVERLOADCOUNT;
813 private static SELECTPROCOVERLOADING_DELEGATE _SELECTPROCOVERLOADING;
814 private static GETSESSIONVALUE_DELEGATE _GETSESSIONVALUE;
815 private static ADDCONNECTION_DELEGATE _ADDCONNECTION;
816 private static WINDOWPIN_DELEGATE _WINDOWPIN;
817 private static FIRSTSELECTEDFILE_DELEGATE _FIRSTSELECTEDFILE;
818 private static NEXTSELECTEDFILE_DELEGATE _NEXTSELECTEDFILE;
819 private static REFRESHFILEBROWSER_DELEGATE _REFRESHFILEBROWSER;
820 private static MAINFONT_DELEGATE _MAINFONT;
821 private static TRANSLATEITEMS_DELEGATE _TRANSLATEITEMS;
822 private static TRANSLATESTRING_DELEGATE _TRANSLATESTRING;
823 private static WINDOWHASEDITOR_DELEGATE _WINDOWHASEDITOR;
824 private static GETBROWSERFILTER_DELEGATE _GETBROWSERFILTER;
825 private static CHECKDBVERSION_DELEGATE _CHECKDBVERSION;
826 private static GETCONNECTIONINFOEX_DELEGATE _GETCONNECTIONINFOEX;
827 private static FINDCONNECTION_DELEGATE _FINDCONNECTION;
828 private static CONNECTCONNECTION_DELEGATE _CONNECTCONNECTION;
829 private static SETMAINCONNECTION_DELEGATE _SETMAINCONNECTION;
830 private static GETWINDOWCONNECTION_DELEGATE _GETWINDOWCONNECTION;
831 private static SETWINDOWCONNECTION_DELEGATE _SETWINDOWCONNECTION;
832 private static GETCONNECTIONTREE_DELEGATE _GETCONNECTIONTREE;
833 private static GETCONNECTIONINFOEX10_DELEGATE _GETCONNECTIONINFOEX10;
834 private static FINDCONNECTIONEX10_DELEGATE _FINDCONNECTIONEX10;
835 private static ADDCONNECTIONEX10_DELEGATE _ADDCONNECTIONEX10;
836 private static GETCONNECTIONTREEEX10_DELEGATE _GETCONNECTIONTREEEX10;
837 #endregion
838
839 #region methods
840 /// <summary>
841 /// Use this function to enable or disable a menu. The ID is the Plug-In ID, which is given by the IdentifyPlugIn function. The Index is the menu index, which the menu was related to by the CreateMenuItem function. The Enabled boolean determines if the menu item is enabled or grayed.
842 /// </summary>
843 public void MenuState(int ID, int Index, bool Enabled)
844 {
845 _MENUSTATE(ID, Index, Enabled);
846 }
847
848 /// <summary>
849 /// Returns a boolean that indicates if PL/SQL Developer is currently connected to a database.
850 /// </summary>
851 public bool Connected()
852 {
853 return _CONNECTED();
854 }
855
856 /// <summary>
857 /// Returns the username, password and database of the current connection.
858 /// </summary>
859 public void GetConnectionInfo(out string Username, out string Password, out string Database)
860 {
861 IntPtr pUsername, pPassword, pDatabase;
862 _GETCONNECTIONINFO(out pUsername, out pPassword, out pDatabase);
863
864 Username = Marshal.PtrToStringAnsi(pUsername);
865 Password = Marshal.PtrToStringAnsi(pPassword);
866 Database = Marshal.PtrToStringAnsi(pDatabase);
867 }
868
869 /// <summary>
870 /// Returns information about the selected item in the Browser. If no item is selected, all items are empty.
871 /// </summary>
872 public void GetBrowserInfo(out string ObjectType, out string ObjectOwner, out string ObjectName)
873 {
874 IntPtr pObjectType, pObjectOwner, pObjectName;
875 _GETBROWSERINFO(out pObjectType, out pObjectOwner, out pObjectName);
876
877 ObjectType = Marshal.PtrToStringAnsi(pObjectType);
878 ObjectOwner = Marshal.PtrToStringAnsi(pObjectOwner);
879 ObjectName = Marshal.PtrToStringAnsi(pObjectName);
880 }
881
882 /// <summary>
883 /// Returns the type of the current window. 1 = SQL Window 2 = Test Window 3 = Procedure Window 4 = Command Window 5 = Plan Window 6 = Report Window 0 = None of the above
884 /// </summary>
885 public int GetWindowType()
886 {
887 return _GETWINDOWTYPE();
888 }
889
890 /// <summary>
891 /// Returns the Application handle of PL/SQL Developer
892 /// </summary>
893 public int GetAppHandle()
894 {
895 return _GETAPPHANDLE();
896 }
897
898 /// <summary>
899 /// Returns the handle of PL/SQL Developers main window
900 /// </summary>
901 public int GetWindowHandle()
902 {
903 return _GETWINDOWHANDLE();
904 }
905
906 /// <summary>
907 /// Returns the handle of PL/SQL Developers client window
908 /// </summary>
909 public int GetClientHandle()
910 {
911 return _GETCLIENTHANDLE();
912 }
913
914 /// <summary>
915 /// Returns the handle of the active child form
916 /// </summary>
917 public int GetChildHandle()
918 {
919 return _GETCHILDHANDLE();
920 }
921
922 /// <summary>
923 /// Resets the state of the menus, buttons and the active window. You can call this function if you made some changes that affect the state of a menu or window which are unnoticed by PL/SQL Developer. Available in version 213
924 /// </summary>
925 public void Refresh()
926 {
927 _REFRESH();
928 }
929
930 /// <summary>
931 /// Creates a new window. The Text parameter contains text that is placed in the window. If the Execute boolean is true, the Window will be executed. WindowType can be one of the following values: 1 = SQL Window 2 = Test Window 3 = Procedure Window 4 = Command Window 5 = Plan Window 6 = Report Window
932 /// </summary>
933
934 public void CreateWindow(int WindowType, string Text, bool Execute)
935 {
936 _CREATEWINDOW(WindowType, Text, Execute);
937 }
938
939 /// <summary>
940 /// Creates a window of type WindowType and loads the specified file. WindowType can be one of the following values: 1 = SQL Window 2 = Test Window 3 = Procedure Window 4 = Command Window The function returns True if successful. Version 301 and higher If you pass 0 as WindowType, PL/SQL Developer will try to determine the actual WindowType on the extension of the filename.
941 /// </summary>
942
943
944 public bool OpenFile(int WindowType, string Filename)
945 {
946 return _OPENFILE(WindowType, Filename);
947 }
948
949 /// <summary>
950 /// This function saves the current window. It returns True if successful.
951 /// </summary>
952 public bool SaveFile()
953 {
954 return _SAVEFILE();
955 }
956
957 /// <summary>
958 /// Return the filename of the current child window. See also SetFilename()
959 /// </summary>
960 public string Filename()
961 {
962 return Marshal.PtrToStringAnsi(_FILENAME());
963 }
964
965 /// <summary>
966 /// Closes the current child window
967 /// </summary>
968 public void CloseFile()
969 {
970 _CLOSEFILE();
971 }
972
973 /// <summary>
974 /// Set the ReadOnly status of the current Window
975 /// </summary>
976 public void SetReadOnly(bool ReadOnly)
977 {
978 _SETREADONLY(ReadOnly);
979 }
980
981 /// <summary>
982 /// Get the ReadOnly status of the current Window Available in version 213
983 /// </summary>
984 public bool GetReadOnly()
985 {
986 return _GETREADONLY();
987 }
988
989 /// <summary>
990 /// This function will execute a query (SQL parameter) and display the result in a ‘result only’ SQL Window. Title will be used as the window name and the Updateable parameter determines if the results are updateable. Available in version 300
991 /// </summary>
992 public bool ExecuteSQLReport(string SQL, string Title, bool Updateable)
993 {
994 return _EXECUTESQLREPORT(SQL, Title, Updateable);
995 }
996
997 /// <summary>
998 /// Forces the active child window to reload its file from disk. Note: In PL/SQL Developer 4 there will no longer be a warning message when modifications were made. Available in version 301
999 /// </summary>
1000 public bool ReloadFile()
1001 {
1002 return _RELOADFILE();
1003 }
1004
1005 /// <summary>
1006 /// Set the filename of the active child window. The filename should contain a valid path, but the file does not need to exist. The new filename will be used when the file is saved. If the Filename parameter is an empty string, the Window will behave as a new created Window. Available in version 303
1007 /// </summary>
1008 public void SetFilename(string Filename)
1009 {
1010 _SETFILENAME(Filename);
1011 }
1012
1013 /// <summary>
1014 /// Retrieves the text from the current child window.
1015 /// </summary>
1016 public string GetText()
1017 {
1018 return Marshal.PtrToStringAnsi(_GETTEXT());
1019 }
1020
1021 /// <summary>
1022 /// Retrieves the selected text from the current child window.
1023 /// </summary>
1024 public string GetSelectedText()
1025 {
1026 return Marshal.PtrToStringAnsi(_GETSELECTEDTEXT());
1027 }
1028
1029 /// <summary>
1030 /// Retrieves the word the cursor is on in the current child window.
1031 /// </summary>
1032 public string GetCursorWord()
1033 {
1034 return Marshal.PtrToStringAnsi(_GETCURSORWORD());
1035 }
1036
1037 /// <summary>
1038 /// Returns the handle of the editor of the current child window.
1039 /// </summary>
1040 public int GetEditorHandle()
1041 {
1042 return _GETEDITORHANDLE();
1043 }
1044
1045 /// <summary>
1046 /// Sets the text in the editor of current window. If this failed for some reason (ReadOnly?), the function returns false. Available in version 213
1047 /// </summary>
1048 public bool SetText(string Text)
1049 {
1050 return _SETTEXT(Text);
1051 }
1052
1053 /// <summary>
1054 /// Places a message in the status bar of the current window, returns false if the window did not have a status bar. Available in version 213
1055 /// </summary>
1056 public bool SetStatusMessage(string Text)
1057 {
1058 return _SETSTATUSMESSAGE(Text);
1059 }
1060
1061 /// <summary>
1062 /// Highlights the given line and places the cursor at the given position. This will only work when the active window is a procedure window, if not, the function returns false. Available in version 213
1063 /// </summary>
1064 public bool SetErrorPosition(int Line, int Col)
1065 {
1066 return _SETERRORPOSITION(Line, Col);
1067 }
1068
1069 /// <summary>
1070 /// Resets the highlighted lines. Available in version 213
1071 /// </summary>
1072 public void ClearErrorPositions()
1073 {
1074 _CLEARERRORPOSITIONS();
1075 }
1076
1077 /// <summary>
1078 /// This function returns the location of the cursor in the word after a call to GetCursorWord. Possible return values: 0: Unknown 1: Cursor was at start of word 2: Cursor was somewhere in the middle 3: Cursor was at the end Available in version 400
1079 /// </summary>
1080 public int GetCursorWordPosition()
1081 {
1082 return _GETCURSORWORDPOSITION();
1083 }
1084
1085 /// <summary>
1086 /// This function allows you to perform a specific action as if the menu item as specified in Param was selected. The following values are supported: 1: Execute 2: Break 3: Kill 4: Commit 5: Rollback 6: Print Available in version 400
1087 /// </summary>
1088 public bool Perform(int Param)
1089 {
1090 return _PERFORM(Param);
1091 }
1092
1093 /// <summary>
1094 /// Returns a list of all keywords as entered in the ‘custom keywords’ option in the Editor preference. Available in version 300
1095 /// </summary>
1096 public string GetCustomKeywords()
1097 {
1098 return Marshal.PtrToStringAnsi(_GETCUSTOMKEYWORDS());
1099 }
1100
1101 /// <summary>
1102 /// Fills the custom keywords with the words in the Keywords parameter. Words should be separated by cr/lf. The currently used keywords will be overwritten. Available in version 300
1103 /// </summary>
1104 public void SetCustomKeywords(string Keywords)
1105 {
1106 _SETCUSTOMKEYWORDS(Keywords);
1107 }
1108
1109 /// <summary>
1110 /// Adds a number of keywords with a specific style. This function is more specific then SetCustomKeywords because this one can set multiple sets of keywords for different highlighting styles. ID should be the PlugIn ID as returned by the IdentifyPlugIn function. Style can be one of the following values: 10: Custom 11: Keywords 12: Comment 13: Strings 14: Numbers 15: Symbols Keywords is a cr/lf separated list of words. You can define one list per style. Available in version 300
1111 /// </summary>
1112 public void SetKeywords(int ID, int Style, string Keywords)
1113 {
1114 _SETKEYWORDS(ID, Style, Keywords);
1115 }
1116
1117 /// <summary>
1118 /// Activates the keywords as defined by the SetKeywords function. Available in version 300
1119 /// </summary>
1120 public void ActivateKeywords()
1121 {
1122 _ACTIVATEKEYWORDS();
1123 }
1124
1125 /// <summary>
1126 /// When this function is called, all menus for this Plug-In are removed and CreateMenuItem will be called to build a new set of menus. This only makes sense if you supply a different set of menu-items. Available in version 300
1127 /// </summary>
1128 public void RefreshMenus(int ID)
1129 {
1130 _REFRESHMENUS(ID);
1131 }
1132
1133 /// <summary>
1134 /// This function allows you to rename a certain menu-item. ID is the Plug-In ID, Index is the Menu number and name is the new menu name. Available in version 300
1135 /// </summary>
1136 public void SetMenuName(int ID, int Index, string Name)
1137 {
1138 _SETMENUNAME(ID, Index, Name);
1139 }
1140
1141 /// <summary>
1142 /// You can display or remove a check mark for a menu-item. Available in version 300
1143 /// </summary>
1144 public void SetMenuCheck(int ID, int Index, bool Enabled)
1145 {
1146 _SETMENUCHECK(ID, Index, Enabled);
1147 }
1148
1149 /// <summary>
1150 /// With this function you can hide or show a specific menu. You can use this instead of MenuState. Available in version 300
1151 /// </summary>
1152 public void SetMenuVisible(int ID, int Index, bool Enabled)
1153 {
1154 _SETMENUVISIBLE(ID, Index, Enabled);
1155 }
1156
1157 /// <summary>
1158 /// Returns a list of all standard PL/SQL Developer menu items. Items are separated by cr/lf and child menu level is indicated by a number of spaces. You can use this function to build an advanced user configuration dialog where the user could be able to select place where he wants to insert the Plug-In menus. Available in version 300
1159 /// </summary>
1160 public string GetMenulayout()
1161 {
1162 return Marshal.PtrToStringAnsi(_GETMENULAYOUT());
1163 }
1164
1165 /// <summary>
1166 /// With this function you can add items to certain popup menus. The ID is the Plug-In ID and the index is the menu index. You can pass any number as the menu index, it can be an existing menu (as used by CreateMenuItem) or anything else. If the popup menu gets selected, OnMenuClick is called with the corresponding index. The Name is the menu name as it will be displayed. The ObjectType determines in which popup menus this item will be displayed. Some possible values are: ‘TABLE’, ‘VIEW’, ‘PACKAGE’, etc. Version 301 and higher If you pass one of the following values as ObjectType, you can add items to specific Windows. PROGRAMWINDOW SQLWINDOW TESTWINDOW COMMANDWINDOW Version 400 and higher You can add popup items to Object Browser items like Tables, Views, etc. by passing their name as ObjectType. Version 510 and higher If you want to create popup menus for multiple selected items (of the same object type), you can add a + to the ObjectType parameter like ‘TABLE+’, ‘VIEW+’, etc. The OnMenuClick will be called for every selected item, and the GetPopupObject will return the correct details. Available in version 300
1167 /// </summary>
1168 ///
1169 public void CreatePopupItem(int ID, int Index, string Name, string ObjectType)
1170 {
1171 _CREATEPOPUPITEM(ID, Index, Name, ObjectType);
1172 }
1173
1174 /// <summary>
1175 /// This function allows you to reconnect PL/SQL Developer as another user. The return value indicates if the connection was successful. The function will fail if there is a childwindow with an active query. Also see SetConnectionAs Available in version 301
1176 /// </summary>
1177 public bool SetConnection(string Username, string Password, string Database)
1178 {
1179 return _SETCONNECTION(Username, Password, Database);
1180 }
1181
1182 /// <summary>
1183 /// This function returns Oracle information about the item in the AnObject parameter. The SubObject returns the name of the procedure if the Object is a packaged procedure. Available in version 400
1184 /// /// </summary>
1185 public int GetObjectInfo(string AnObject, out string ObjectType, out string ObjectOwner, out string ObjectName, out string SubObject)
1186 {
1187 IntPtr pObjectType, pObjectOwner, pObjectName, pSubObject;
1188 int result = _GETOBJECTINFO(AnObject, out pObjectType, out pObjectOwner, out pObjectName, out pSubObject);
1189
1190 ObjectType = Marshal.PtrToStringAnsi(pObjectType);
1191 ObjectOwner = Marshal.PtrToStringAnsi(pObjectOwner);
1192 ObjectName = Marshal.PtrToStringAnsi(pObjectName);
1193 SubObject = Marshal.PtrToStringAnsi(pSubObject);
1194
1195 return result;
1196 }
1197
1198 /// <summary>
1199 /// Returns a cr/lf separated list of items from the Object Browser. The Node parameter determines which items are returned. This can be one of the main items like TABLES, but you can also us a slash to get more specific items like TABLES/DEPT/COLUMNS. The GetItems [MarshalAs(UnmanagedType.Bool)] boolean determines if PL/SQL Developer will fetch these values from the database if the item has not been opened yet in the Browser. Available in version 400
1200 /// </summary>
1201 public string GetBrowserItems(string Node, bool GetItems)
1202 {
1203 return Marshal.PtrToStringAnsi(_GETBROWSERITEMS(Node, GetItems));
1204 }
1205
1206 /// <summary>
1207 /// Force a refresh to the Object Browser. If Node is empty, all items are refreshed.
1208 /// To refresh a specific item you can enter the name in the Node parameter.
1209 /// Note: Version 500 allows you to pass a * to refresh the current selected browser item.
1210 /// Available in version 400
1211 /// Note: Version 500 allows you to pass a * to refresh the current selected browser item.
1212 /// Note: Version 600 allows you to pass a ** to refresh to parent of the current browser item, and you can pass *** to refresh to root item.
1213 /// </summary>
1214 public void RefreshBrowser(string Node)
1215 {
1216 _REFRESHBROWSER(Node);
1217 }
1218
1219 /// <summary>
1220 /// This function returns information about the item for which a popup menu (created with CreatePopupItem) was activated.
1221 /// If the item is a Browser folder, the name of the folder will be returned in ObjectName and ObjectType will return ‘FOLDER’
1222 /// Available in version 400
1223 /// </summary>
1224 public int GetPopupObject(out string ObjectType, out string ObjectOwner, out string ObjectName, out string SubObject)
1225 {
1226 IntPtr pObjectType, pObjectOwner, pObjectName, pSubObject;
1227 int result = _GETPOPUPOBJECT(out pObjectType, out pObjectOwner, out pObjectName, out pSubObject);
1228
1229 ObjectType = Marshal.PtrToStringAnsi(pObjectType);
1230 ObjectOwner = Marshal.PtrToStringAnsi(pObjectOwner);
1231 ObjectName = Marshal.PtrToStringAnsi(pObjectName);
1232 SubObject = Marshal.PtrToStringAnsi(pSubObject);
1233
1234 return result;
1235 }
1236
1237 /// <summary>
1238 /// This function returns the name of browser root item for which a popup menu (created with CreatePopupItem) was activated. Available in version 400
1239 /// </summary>
1240 public string GetPopupBrowserRoot()
1241 {
1242 return Marshal.PtrToStringAnsi(_GETPOPUPBROWSERROOT());
1243 }
1244
1245 /// <summary>
1246 /// If you modify database objects in your Plug-In and you want to update PL/SQL Developer to reflect these changes, you can do so by calling this function. You should pass the object type, owner, name and the action that you performed on the object. The action can be one of the following: 1 = Object created 2 = Object modified 3 = Object deleted PL/SQL Developer will update the browser and all windows that might use the object. Available in version 400
1247 /// </summary>
1248 public void RefreshObject(string ObjectType, string ObjectOwner, string ObjectName, int Action)
1249 {
1250 _REFRESHOBJECT(ObjectType, ObjectOwner, ObjectName, Action);
1251 }
1252
1253 /// <summary>
1254 /// This function will return the details of the first selected in the Browser. The function will return false if no items are selected. Use in combination with NextSelectedObject to determine all selected items. Available in version 500
1255 /// </summary>
1256 public bool FirstSelectedObject(string ObjectType, string ObjectOwner, string ObjectName, string SubObject)
1257 {
1258 return _FIRSTSELECTEDOBJECT(ObjectType, ObjectOwner, ObjectName, SubObject);
1259 }
1260
1261 /// <summary>
1262 /// This function can be called after a call to FirstSelectedObject to determine all selected objects. You can keep calling this function until it returns false. Available in version 500
1263 /// </summary>
1264 public bool NextSelectedObject(string ObjectType, string ObjectOwner, string ObjectName, string SubObject)
1265 {
1266 return _NEXTSELECTEDOBJECT(ObjectType, ObjectOwner, ObjectName, SubObject);
1267 }
1268
1269 /// <summary>
1270 /// Returns the source for the specified object. This function will only return source for objects that actually have source (packages, views, …). Available in version 511
1271 /// </summary>
1272 public string GetObjectSource(string ObjectType, string ObjectOwner, string ObjectName)
1273 {
1274 return Marshal.PtrToStringAnsi(_GETOBJECTSOURCE(ObjectType, ObjectOwner, ObjectName));
1275 }
1276
1277 /// <summary>
1278 /// Returns the number of child windows in PL/SQL Developer. In combination with SelectWindow you can communicate with all child windows. Available in version 301
1279 /// </summary>
1280 public int GetWindowCount()
1281 {
1282 return _GETWINDOWCOUNT();
1283 }
1284
1285 /// <summary>
1286 /// This function will ‘select’ one of PL/SQL Developers child Windows.
1287 /// Index is the window number where 0 is the top child window. The return value will indicate if the window existed.
1288 /// Normally all window related functions communicate with the active child window. With this function you can select any window
1289 /// and all window-related IDE functions will refer to the selected window.
1290 /// Note: SelectWindow does not actually bring the window to front, you need ActivateWindow to do that.
1291 /// Available in version 301
1292 /// </summary>
1293 public bool SelectWindow(int Index)
1294 {
1295 return _SELECTWINDOW(Index);
1296 }
1297
1298 /// <summary>
1299 /// Brings the Indexth child window with to front. Available in version 301
1300 /// </summary>
1301 /// </summary>
1302 public bool ActivateWindow(int Index)
1303 {
1304 return _ACTIVATEWINDOW(Index);
1305 }
1306
1307 /// <summary>
1308 /// Returns if the contents of the window is modified. Available in version 301
1309 /// </summary>
1310 public bool WindowIsModified()
1311 {
1312 return _WINDOWISMODIFIED();
1313 }
1314
1315 /// <summary>
1316 /// Returns if there is anything running in the current window. Available in version 301
1317 /// </summary>
1318 public bool WindowIsRunning()
1319 {
1320 return _WINDOWISRUNNING();
1321 }
1322 /// <summary>
1323 /// Creates an empty splash screen (the one you see when PL/SQL Developer is starting or printing) which allows you to show some kind of progress on lengthy operations. If the ProgressMax parameter is larger then 0, a progress bar is displayed which you can advance with the SplashProgress function. Note: There can only be one splash screen active at a time. If a splash screen is created while one was active, the first one will get re-used. Available in version 303
1324 /// </summary>
1325 ///
1326 public void SplashCreate(int ProgressMax)
1327 {
1328 _SPLASHCREATE(ProgressMax);
1329 }
1330
1331 /// <summary>
1332 /// Hides the splash screen. This function will work on any splash screen, you can even hide the one created by PL/SQL Developer. Available in version 303
1333 /// </summary>
1334 public void SplashHide()
1335 {
1336 _SPLASHHIDE();
1337 }
1338
1339 /// <summary>
1340 /// Add text to the splash screen. Available in version 303
1341 /// </summary>
1342 public void SplashWrite(string s)
1343 {
1344 _SPLASHWRITE(s);
1345 }
1346
1347 /// <summary>
1348 /// Add text to the splash screen beginning on the next line. Available in version 303
1349 /// </summary>
1350 public void SplashWriteLn(string s)
1351 {
1352 _SPLASHWRITELN(s);
1353 }
1354
1355 /// <summary>
1356 /// If the splash screen was created with a progress bar, you can indicate progress with this function. Available in version 303
1357 /// </summary>
1358 public void SplashProgress(int Progress)
1359 {
1360 _SPLASHPROGRESS(Progress);
1361 }
1362
1363 /// <summary>
1364 /// This function returns the path where the templates are located. Available in version 400
1365 /// </summary>
1366 public string TemplatePath()
1367 {
1368 return Marshal.PtrToStringAnsi(_TEMPLATEPATH());
1369 }
1370
1371 /// <summary>
1372 /// If you want to execute a template from within your PlugIn you can do so with this function. The NewWindow parameter indicates if a new window should be created or that the result of the template should be pasted at the current cursor position in the active window. The template parameter should contain the template name. If the template is located in one or more folders, the folder name(s) should be prefixed to the template name separated by a backslash. Available in version 400
1373 /// </summary>
1374 public bool ExecuteTemplate(string Template, bool NewWindow)
1375 {
1376 return _EXECUTETEMPLATE(Template, NewWindow);
1377 }
1378
1379 /// <summary>
1380 /// Use this function to determine if the current connection has a specific ‘Connect As’. Possible return values are: '', 'SYSDBA' and 'SYSOPER' Available in version 500
1381 /// </summary>
1382 public string GetConnectAs()
1383 {
1384 return Marshal.PtrToStringAnsi(_GETCONNECTAS());
1385 }
1386
1387 /// <summary>
1388 /// Identical to SetConnection, but with an option to specify a ConnectAs parameter. You can pass 'SYSDBA' or 'SYSOPER', all other values will be handled as 'NORMAL'. Available in version 500
1389 /// </summary>
1390 public bool SetConnectionAs(string Username, string Password, string Database, string ConnectAs)
1391 {
1392 return _SETCONNECTIONAS(Username, Password, Database, ConnectAs);
1393 }
1394
1395 /// <summary>
1396 /// If you want to create a new ‘File Open’ menu with the same items as the standard menu, you can use this function to determine the standard items. You can call this function in a loop while incrementing MenuIndex (starting with 0) until the return value is an empty string. The return values are the menu names in the File Open menu and the WindowType is the corresponding window type. Available in version 400
1397 /// </summary>
1398 public string GetFileOpenMenu(int MenuIndex, out int WindowType)
1399 {
1400 return Marshal.PtrToStringAnsi(_GETFILEOPENMENU(MenuIndex, out WindowType));
1401 }
1402
1403 /// <summary>
1404 /// Returns True if the active child window can be saved. (which are the SQL, Test, Program and Command windows). Available in version 400
1405 /// </summary>
1406 public bool CanSaveWindow()
1407 {
1408 return _CANSAVEWINDOW();
1409 }
1410
1411 /// <summary>
1412 /// Creates a new Window (of type WindowType) for the specified (and registered) FileSystem, Tag and Filename. Available in version 400
1413 /// </summary>
1414 public void OpenFileExternal(int WindowType, string Data, string FileSystem, string Tag, string Filename)
1415 {
1416 _OPENFILEEXTERNAL(WindowType, Data, FileSystem, Tag, Filename);
1417 }
1418
1419 /// <summary>
1420 /// Returns the defined filetypes for a specific WindowType. Available in version 400
1421 /// </summary>
1422 public string GetFileTypes(int WindowType)
1423 {
1424 return Marshal.PtrToStringAnsi(_GETFILETYPES(WindowType));
1425 }
1426
1427 /// <summary>
1428 /// Returns the default extension (without period) for a specific window type. Available in version 400
1429 /// </summary>
1430 public string GetDefaultExtension(int WindowType)
1431 {
1432 return Marshal.PtrToStringAnsi(_GETDEFAULTEXTENSION(WindowType));
1433 }
1434
1435 /// <summary>
1436 /// Returns the data of a window. You can use this function to get the data and save it. Available in version 400
1437 /// </summary>
1438 public string GetFiledata()
1439 {
1440 return Marshal.PtrToStringAnsi(_GETFILEDATA());
1441 }
1442
1443 /// <summary>
1444 /// You can call this function when a file is saved successfully. The filename will be set in the Window caption and the status will display that the file is ‘saved successfully’. FileSystem and FileTag can be nil. Available in version 400
1445 /// </summary>
1446
1447 public void FileSaved(string FileSystem, string FileTag, string Filename)
1448 {
1449 _FILESAVED(FileSystem, FileTag, Filename);
1450 }
1451
1452 /// <summary>
1453 /// This function displays a html file in a child window. The url parameter identifies the file and the hash parameter allows you to jump to a specific location. The title parameter will be used as window title. You can refresh the contents of an already opened window by specifying an ID. If ID is not empty, and a window exists with the same ID, this will be used, otherwise a new window will be created.
1454 /// </summary>
1455 /// <param name="Url"></param>
1456 /// <param name="Hash"></param>
1457 /// <param name="Title"></param>
1458 /// <param name="ID"></param>
1459 /// <returns></returns>
1460 public bool ShowHTML(string Url, string Hash, string Title, string ID)
1461 {
1462 return _SHOWHTML(Url, Hash, Title, ID);
1463 }
1464
1465 /// <summary>
1466 /// Refresh the contents of a HTML Window. You can pass a url to refress all windows that show a specific url, or you can pass an ID to refresh a specific Window. Available in version 512
1467 /// </summary>
1468 public bool RefreshHTML(string Url, string ID, bool BringToFront)
1469 {
1470 return _REFRESHHTML(Url, ID, BringToFront);
1471 }
1472
1473 /// <summary>
1474 /// Returns the define file extension of a specific object type. The oType parameter can hold one of the following valies:
1475 /// </summary>
1476 /// <param name="oType"></param>
1477 /// <returns>FUNCTION, PROCEDURE, TRIGGER, PACKAGE, PACKAGE BODY, PACKAGE SPEC AND BODY, TYPE, TYPE BODY, TYPE SPEC AND BODY, JAVA SOURCE</returns>
1478 public string GetProcEditExtension(string oType)
1479 {
1480 return Marshal.PtrToStringAnsi(_GETPROCEDITEXTENSION(oType));
1481 }
1482
1483 /// <summary>
1484 /// Get info about the object opened in a Window. This will only work for Program Windows. Available in version 512
1485 /// </summary>
1486 public bool GetWindowObject(out string ObjectType, out string ObjectOwner, out string ObjectName, out string SubObject)
1487 {
1488 IntPtr pObjectType, pObjectOwner, pObjectName, pSubObject;
1489 bool result = _GETWINDOWOBJECT(out pObjectType, out pObjectOwner, out pObjectName, out pSubObject);
1490
1491 ObjectType = Marshal.PtrToStringAnsi(pObjectType);
1492 ObjectOwner = Marshal.PtrToStringAnsi(pObjectOwner);
1493 ObjectName = Marshal.PtrToStringAnsi(pObjectName);
1494 SubObject = Marshal.PtrToStringAnsi(pSubObject);
1495
1496 return result;
1497 }
1498
1499 /// <summary>
1500 /// Simulates a key press. You can use this function to do the things you can also do with the keyboard. The Key parameter is the virtual key code of the key, and the Shift parameter holds the status of the Shift Ctrl and Alt keys. You can combine the following values: 1 = Shift 2 = Alt 3 = Ctrl Available in version 510
1501 /// </summary>
1502 public void KeyPress(int Key, int Shift)
1503 {
1504 _KEYPRESS(Key, Shift);
1505 }
1506
1507 /// <summary>
1508 /// This function will return an ‘index’ of a specific menu item. The MenuName parameter must specify the menu path separated by a slash, for example ‘edit / selection / uppercase’. The menu name is not case sensitive. If the function returns zero, the menu did not exist. You can use the return value with SelectMenu Available in version 510
1509 /// </summary>
1510 public int GetMenuItem(string MenuName)
1511 {
1512 return _GETMENUITEM(MenuName);
1513 }
1514
1515 /// <summary>
1516 /// You can execute a menu item with this function. The MenuItem parameter has to be determined by the SelectMenu function. If this function returns false, the menu did not exist, or it was disabled. Available in version 510
1517 /// </summary>
1518 public bool SelectMenu(int MenuItem)
1519 {
1520 return _SELECTMENU(MenuItem);
1521 }
1522
1523 /// <summary>
1524 /// Returns the currently used translation file. If the return value is empty, no translation is used. Available in version 510
1525 /// </summary>
1526 public string TranslationFile()
1527 {
1528 return Marshal.PtrToStringAnsi(_TRANSLATIONFILE());
1529 }
1530
1531 /// <summary>
1532 /// Returns the language of the currently used translation file. If the return value is empty, no translation is used. Available in version 510
1533 /// </summary>
1534 public string TranslationLanguage()
1535 {
1536 return Marshal.PtrToStringAnsi(_TRANSLATIONLANGUAGE());
1537 }
1538
1539 /// <summary>
1540 /// Returns a list of all standard PL/SQL Developer menu items like GetMenuLayout, but this function will return the translated menus. Available in version 510
1541 /// </summary>
1542 public string GetTranslatedMenuLayout()
1543 {
1544 return Marshal.PtrToStringAnsi(_GETTRANSLATEDMENULAYOUT());
1545 }
1546
1547 /// <summary>
1548 /// PL/SQL Developer has a preference to save all opened files on a time interval, and/or when an Execute is performed. In case of a crash (from the system, Oracle or PL/SQL Dev), the user will be able to recover the edited files. If the Plug-In can do things that have a possible risk of causing a crash, you can call this function to protect the user’s work. Available in version 510
1549 /// </summary>
1550 public bool SaveRecoveryFiles()
1551 {
1552 return _SAVERECOVERYFILES();
1553 }
1554
1555 /// <summary>
1556 /// Returns the (1 based) character position of the cursor in the current editor. Available in version 510
1557 /// </summary>
1558 public int GetCursorX()
1559 {
1560 return _GETCURSORX();
1561 }
1562
1563 /// <summary>
1564 /// Returns the (1 based) line position of the cusror in the current editor. Available in version 510
1565 /// </summary>
1566 public int GetCursorY()
1567 {
1568 return _GETCURSORY();
1569 }
1570
1571 /// <summary>
1572 /// Set the cursor in the current editor. If the X or Y parameter is 0, the position will not change. This function will also update the position display in the statusbar. Available in version 510
1573 /// </summary>
1574 public void SetCursor(int X, int Y)
1575 {
1576 _SETCURSOR(X, Y);
1577 }
1578
1579 /// <summary>
1580 /// Create a bookmark at position X (character), Y (line). Index is the bookmark (0..9) you want to set. If you pass –1 as bookmark, the first free bookmark will be used. The returned value is the used bookmark. Normally, from within PL/SQL Developer. Bookmarks can only be used for windows with a gutter (Test window and Program editor), but the Plug-In interface allows you to use bookmarks for all windows. Available in version 510
1581 /// </summary>
1582 public int SetBookmark(int Index, int X, int Y)
1583 {
1584 return _SETBOOKMARK(Index, X, Y);
1585 }
1586
1587 /// <summary>
1588 /// Clears the specified bookmark Available in version 510
1589 /// </summary>
1590 public void ClearBookmark(int Index)
1591 {
1592 _CLEARBOOKMARK(Index);
1593 }
1594
1595 /// <summary>
1596 /// Jumps to a bookmark Available in version 510
1597 /// </summary>
1598 public void GotoBookmark(int Index)
1599 {
1600 _GOTOBOOKMARK(Index);
1601 }
1602
1603 /// <summary>
1604 /// Get the cursor position for a specific bookmark Available in version 510
1605 /// </summary>
1606 public bool GetBookmark(int Index, int X, int Y)
1607 {
1608 return _GETBOOKMARK(Index, X, Y);
1609 }
1610
1611 /// <summary>
1612 /// Returns the description tab page Index (zero based). The return value is empty if the tab page does not exist. This function allows you to determine which tab pages (if any) are available for the current window. Available in version 511
1613 /// </summary>
1614 public string TabInfo(int Index)
1615 {
1616 return Marshal.PtrToStringAnsi(_TABINFO(Index));
1617 }
1618
1619 /// <summary>
1620 /// This function allows you to read or set the active tab page. To set a specific page, pass a zero based value to the Index parameter. The return value is the actual selected page. To determine the active page (without setting it) pass a value of –1 to the Index parameter
1621 /// </summary>
1622 /// <param name="Index"></param>
1623 /// <returns></returns>
1624 public int TabIndex(int Index)
1625 {
1626 return _TABINDEX(Index);
1627 }
1628
1629 /// <summary>
1630 /// This function allows you to add Toolbuttons to your Plug-In, similar to CreatePopupItem. The ID is the Plug-In ID and the index is the menu index. When a button is selected, OnMenuClick is called with the corresponding index. The Name will appear as hint for the button, and as name in the preferences dialog. The button can be enabled and disabled with MenuState. The image for the button can be set by passing a filename to a bmp file in the BitmapFile parameter, or as a handle to a bitmap in memory. The bmp image can have any number of colors, but should approximately be 20 x 20 pixels in size. The button will only be visible if it is selected in the Toolbar preference. Available in version 510
1631 /// </summary>
1632 public void CreateToolButton(int ID, int Index, string Name, string BitmapFile, int BitmapHandle)
1633 {
1634 _CREATETOOLBUTTON(ID, Index, Name, BitmapFile, BitmapHandle);
1635 }
1636
1637 /// <summary>
1638 /// Returns the PL/SQL Beautifier options. The result is a value where the following values are or-ed together: 1 AfterCreating enabled 2 AfterLoading enabled 4 BeforeCompiling enabled 8 BeforeSaving enabled You can use this to determine if you need to call the beautifier. Available in version 510
1639 /// </summary>
1640 public int BeautifierOptions()
1641 {
1642 return _BEAUTIFIEROPTIONS();
1643 }
1644
1645 /// <summary>
1646 /// Calls the PL/SQL Beautifier for the current Window. The result indicates if the operations succeeded. Available in version 510
1647 /// </summary>
1648 public bool BeautifyWindow()
1649 {
1650 return _BEAUTIFYWINDOW();
1651 }
1652
1653 /// <summary>
1654 /// Calls the PL/SQL Beautifier to beautify the text in the S parameter. The result is the beautified text or it is empty if the function failed Available in version 510
1655 /// </summary>
1656 public string BeautifyText(string S)
1657 {
1658 return Marshal.PtrToStringAnsi(_BEAUTIFYTEXT(S));
1659 }
1660
1661 /// <summary>
1662 /// This function allows you to do a specific action for the object specified. The following actions are available: VIEW, VIEWSPECANDBODY, EDIT, EDITSPECANDBODY, EDITDATA, QUERYDATA, TEST Available in version 514
1663 /// </summary>
1664 public bool ObjectAction(string Action, string ObjectType, string ObjectOwner, string ObjectName)
1665 {
1666 return _OBJECTACTION(Action, ObjectType, ObjectOwner, ObjectName);
1667 }
1668
1669 /// <summary>
1670 /// This allows you to start a specific PL/SQL Developer dialog. The following are supported: AUTHORIZATIONS PROJECTITEMS BREAKPOINTS PREFERENCES CONFIG PLUGINS CONFIG TOOLS CONFIG DOCUMENTS CONFIG REPORTS CONFIG MACROS CONFIG AUTOREFRESH The Param parameter is for future use. Available in version 700
1671 /// </summary>
1672 public bool ShowDialog(string Dialog, string Param)
1673 {
1674 return _SHOWDIALOG(Dialog, Param);
1675 }
1676
1677 /// <summary>
1678 /// When debuggin is on, this function allows you to add messages in the debug.txt file generated. Available in version 700
1679 /// </summary>
1680 public void DebugLog(string Msg)
1681 {
1682 _DEBUGLOG(Msg);
1683 }
1684
1685 /// <summary>
1686 /// This function returns a command-line parameter, or a parameter specified in the params.ini file. Available in version 700
1687 /// </summary>
1688 public string GetParamString(string Name)
1689 {
1690 return Marshal.PtrToStringAnsi(_GETPARAMSTRING(Name));
1691 }
1692
1693 /// <summary>
1694 /// This function returns a command-line parameter, or a parameter specified in the params.ini file. Available in version 700
1695 /// </summary>
1696 public bool GetParambool(string Name)
1697 {
1698 return _GETPARAMBOOL(Name);
1699 }
1700
1701 /// <summary>
1702 /// This function allows you to return feedback to the command window. The description S will be displayed in the window identified by the FeedbackHandle. See the CommandLine Plug-In function for details. Available in version 513
1703 /// </summary>
1704 public void CommandFeedback(int FeedbackHandle, string S)
1705 {
1706 _COMMANDFEEDBACK(FeedbackHandle, S);
1707 }
1708
1709 /// <summary>
1710 /// Returns the number of rows in the result grid of a SQL or Test Window. Available in version 516
1711 /// </summary>
1712 public int ResultGridRowCount()
1713 {
1714 return _RESULTGRIDROWCOUNT();
1715 }
1716
1717 /// <summary>
1718 /// Returns the number of cols in the result grid of a SQL or Test Window. Available in version 516
1719 /// </summary>
1720 public int ResultGridColCount()
1721 {
1722 return _RESULTGRIDCOLCOUNT();
1723 }
1724
1725 /// <summary>
1726 /// This function allows you to access the results of a query in a SQL or Test Window. Use the above two functions to determine the number of rows and cols. Available in version 516
1727 /// </summary>
1728 public string ResultGridCell(int Col, int Row)
1729 {
1730 return Marshal.PtrToStringAnsi(_RESULTGRIDCELL(Col, Row));
1731 }
1732
1733 /// <summary>
1734 /// In PL/SQL Developer 6 we introduced the concept of Authorization. You should test if a specific feature is allowed for the current user with this function. In the Category parameter you can specify one of the main categories (objects, menus, system). The name parameter specifies the item (session.kill or objects.drop). Some items have a subname, like objects.drop with the different objects. Available in version 600
1735 /// </summary>
1736 public bool Authorized(string Category, string Name, string SubName)
1737 {
1738 return _AUTHORIZED(Category, Name, SubName);
1739 }
1740
1741 /// <summary>
1742 /// For a quick check if authorization allows the Plug-In to create a specific function, you can use this function. Available in version 600
1743 /// </summary>
1744 public bool WindowAllowed(int WindowType, bool ShowErrorMessage)
1745 {
1746 return _WINDOWALLOWED(WindowType, ShowErrorMessage);
1747 }
1748
1749 /// <summary>
1750 /// Returns if authorization is enabled or not. Available in version 600
1751 /// </summary>
1752 public bool Authorization()
1753 {
1754 return _AUTHORIZATION();
1755 }
1756
1757 /// <summary>
1758 /// If you want a list off all available authorization items, you can call this function. It will return a cr/lf separated list. Available in version 600
1759 /// </summary>
1760 public string AuthorizationItems(string Category)
1761 {
1762 return Marshal.PtrToStringAnsi(_AUTHORIZATIONITEMS(Category));
1763 }
1764
1765 /// <summary>
1766 /// If you want to add items to the authorization list to allow them to be managed through the authorization option, you can use this function. Pass the PlugInID to identify your Plug-In, and pass the Name parameter with the item you want to add. The name should be unique, so you should prefix it with the name the Plug-In, for example: MyPlugIn.Create New Command All items will be added in the PlugIns category, so if you want to test if this feature is allowed you should call: Authorized('PlugIns ', ' MyPlugIn.Create New Command') Available in version 600
1767 /// </summary>
1768 public void AddAuthorizationItem(int PlugInID, string Name)
1769 {
1770 _ADDAUTHORIZATIONITEM(PlugInID, Name);
1771 }
1772
1773 /// <summary>
1774 /// Returns a list of all personal preference sets. If you to have the Plug-In to use different preferences depending on the current connection, you can use this function to build a list of possible preference sets. Available in version 600
1775 /// </summary>
1776 public string GetPersonalPrefSets()
1777 {
1778 return Marshal.PtrToStringAnsi(_GETPERSONALPREFSETS());
1779 }
1780
1781 /// <summary>
1782 /// Returns a list of all default preference sets. Available in version 600
1783 /// </summary>
1784 public string GetDefaultPrefSets()
1785 {
1786 return Marshal.PtrToStringAnsi(_GETDEFAULTPREFSETS());
1787 }
1788
1789 /// <summary>
1790 /// Read a Plug-In preference from the preferences. In PL/SQL Developer 6, personal preferences are stored in files, not in the registry. You can still use the registry, but if you want to store your preferences in a shared location, you can use this function. Pass the PlugInID you received with the IdentifyPlugIn call. The PrefSet parameter can be empty to retrieve default preferences, or you can specify one of the existing preference sets. Available in version 600
1791 /// </summary>
1792 public bool GetPrefAsString(int PlugInID, string PrefSet, string Name, string Default)
1793 {
1794 return _GETPREFASSTRING(PlugInID, PrefSet, Name, Default);
1795 }
1796
1797 /// <summary>
1798 /// As GetPrefAsString, but for integers. Available in version 600
1799 /// </summary>
1800 public int GetPrefAsInteger(int PlugInID, string PrefSet, string Name, bool Default)
1801 {
1802 return _GETPREFASINTEGER(PlugInID, PrefSet, Name, Default);
1803 }
1804
1805 /// <summary>
1806 /// As GetPrefAsString, but for booleans. Available in version 600
1807 /// </summary>
1808 public bool GetPrefAsbool(int PlugInID, string PrefSet, string Name, bool Default)
1809 {
1810 return _GETPREFASBOOL(PlugInID, PrefSet, Name, Default);
1811 }
1812
1813 /// <summary>
1814 /// Set a Plug-In preference. Pass the PlugInID you received with the IdentifyPlugIn call. The PrefSet parameter can be empty to set default preferences, or you can specify one of the existing preference sets. The return value indicates if the function succeeded. Available in version 600
1815 /// </summary>
1816 public bool SetPrefAsString(int PlugInID, string PrefSet, string Name, string Value)
1817 {
1818 return _SETPREFASSTRING(PlugInID, PrefSet, Name, Value);
1819 }
1820
1821 /// <summary>
1822 /// As SetPrefAsString, but for integers. Available in version 600
1823 /// </summary>
1824 public bool SetPrefAsInteger(int PlugInID, string PrefSet, string Name, int Value)
1825 {
1826 return _SETPREFASINTEGER(PlugInID, PrefSet, Name, Value);
1827 }
1828
1829 /// <summary>
1830 /// As SetPrefAsString, but for booleans. Available in version 600
1831 /// </summary>
1832 ///
1833 public bool SetPrefAsbool(int PlugInID, string PrefSet, string Name, bool Value)
1834 {
1835 return _SETPREFASBOOL(PlugInID, PrefSet, Name, Value);
1836 }
1837
1838 /// <summary>
1839 /// Returns the value of a preference. The names can be found in the preference ini file under the [Preferences] section. Available in version 700
1840 /// </summary>
1841 public string GetGeneralPref(string Name)
1842 {
1843 return Marshal.PtrToStringAnsi(_GETGENERALPREF(Name));
1844 }
1845
1846 /// <summary>
1847 /// This will overrule default app behavior. Currently only the setting "NOFILEDATECHECK" is supported where you can pass "TRUE" or "FALSE"
1848 /// </summary>
1849
1850 public bool PlugInSetting(int PlugInID, string Setting, string Value)
1851 {
1852 return _PLUGINSETTING(PlugInID, Setting, Value);
1853 }
1854 /// <summary>
1855 /// Returns the number of overloads for a specific procedure. Result < 0 = Procedure doesn`t exist Result > 0 = overload count Available in version 700
1856 /// </summary>
1857
1858 public int GetProcOverloadCount(string Owner, string PackageName, string ProcedureName)
1859 {
1860 return _GETPROCOVERLOADCOUNT(Owner, PackageName, ProcedureName);
1861 }
1862 /// <summary>
1863 /// Shows a dialog to allow the user to select an overloaded procedure. Result < 0 = Cancel Result 0 = No overloadings Result > 0 = Overload index Available in version 700
1864 /// </summary>
1865
1866 public int SelectProcOverloading(string Owner, string PackageName, string ProcedureName)
1867 {
1868 return _SELECTPROCOVERLOADING(Owner, PackageName, ProcedureName);
1869 }
1870
1871 /// <summary>
1872 /// This function will return one of the Session parameters as you see in the grid of the session tool. You will only get a result if the Session Window is active, so this will only work from a Popup menu created for the SESSIONWINDOW object. Available in version 700
1873 /// </summary>
1874 public string GetSessionValue(string Name)
1875 {
1876 return Marshal.PtrToStringAnsi(_GETSESSIONVALUE(Name));
1877 }
1878 /// <summary>
1879 /// This functions allows you to add a connection. If it already exists it won’t be added twice. The result will be the new or existing index. See also AddConnectionEx10().
1880 /// </summary>
1881
1882 public int AddConnection(string Username, string Password, string Database, string ConnectAs)
1883 {
1884 return _ADDCONNECTION(Username, Password, Database, ConnectAs);
1885 }
1886
1887 /// <summary>
1888 /// This function can be used to get or set the status of a the current windows connection pinning. As Pin parameter you can use 0 to set pinning off, or 1 to pin the connection. Value 2 will not change the pinned status.
1889 /// </summary>
1890 public int WindowPin(int Pin)
1891 {
1892 return _WINDOWPIN(Pin);
1893 }
1894
1895 /// <summary>
1896 /// Returns the first selected item in the file browser. Use NextSelectedFile for multiple selected items. The Files and Directories parameters allow you to specify if you do or don’t want selected files and/or directories.
1897 /// </summary>
1898 /// <param name="Files"></param>
1899 /// <param name="Directories"></param>
1900 public string FirstSelectedFile(bool Files, bool Directories)
1901 {
1902 return Marshal.PtrToStringAnsi(_FIRSTSELECTEDFILE(Files, Directories));
1903 }
1904
1905 /// <summary>
1906 /// Returns the next selected item. See the previous function. Returns empty value when no more items.
1907 /// </summary>
1908 public string NextSelectedFile()
1909 {
1910 return Marshal.PtrToStringAnsi(_NEXTSELECTEDFILE());
1911 }
1912
1913 /// <summary>
1914 /// Forces the file browser to refresh the contents. Normally the browser will autodetect changes.
1915 /// </summary>
1916 public void RefreshFileBrowser()
1917 {
1918 _REFRESHFILEBROWSER();
1919 }
1920
1921 /// <summary>
1922 /// Forces the file browser to refresh the contents. Normally the browser will autodetect changes.
1923 /// </summary>
1924 public string MainFont()
1925 {
1926 return Marshal.PtrToStringAnsi(_MAINFONT());
1927 }
1928
1929 /// <summary>
1930 /// Return the PL/SQL Developer main font in the format: “Name”, size, color, charset, “style”
1931 /// </summary>
1932 public string TranslateItems(string Group)
1933 {
1934 return Marshal.PtrToStringAnsi(_TRANSLATEITEMS(Group));
1935 }
1936
1937 /// <summary>
1938 /// Function for translating items.
1939 /// </summary>
1940 public string TranslateString(string ID, string Default, string Param1, string Param2)
1941 {
1942 return Marshal.PtrToStringAnsi(_TRANSLATESTRING(ID, Default, Param1, Param2));
1943 }
1944
1945 /// <summary>
1946 /// Returns true if the current Window has an Editor. If the CodeEditor parameter is true, it returns false for editors like the output editor.
1947 /// </summary>
1948 public bool WindowHasEditor(bool CodeEditor)
1949 {
1950 return _WINDOWHASEDITOR(CodeEditor);
1951 }
1952
1953 /// <summary>
1954 /// This function returns the defined browser filters. You can use this if the Plug-in has a similar requirement. Index = 0 and higher, and the returned values are empty if the filter does not exist.
1955 /// </summary>
1956 public void GetBrowserFilter(int Index, out string Name, out string WhereClause, out string OrderByClause, out string User, [MarshalAs(UnmanagedType.Bool)] bool Active)
1957 {
1958 IntPtr pName, pWhereClause, pOrderByClause, pUser;
1959 _GETBROWSERFILTER(Index, out pName, out pWhereClause, out pOrderByClause, out pUser, Active);
1960
1961 Name = Marshal.PtrToStringAnsi(pName);
1962 WhereClause = Marshal.PtrToStringAnsi(pWhereClause);
1963 OrderByClause = Marshal.PtrToStringAnsi(pOrderByClause);
1964 User = Marshal.PtrToStringAnsi(pUser);
1965 }
1966
1967 /// <summary>
1968 /// You can use this function to check if the database is equal or higher then the specified version. The parameter should be in the format aa.bb, like 09.02 or 10.00.
1969 /// </summary>
1970 public bool CheckDBVersion(string Version)
1971 {
1972 return _CHECKDBVERSION(Version);
1973 }
1974
1975 /// <summary>
1976 /// In version 9.0, multiple connections are introduced. This function will iterate through all available (recent) connections. You can start with ix = 0 and continue until you receive a false as result. The other parameters return the details of each connection.
1977 /// </summary>
1978 public bool GetConnectionInfoEx(int ix, out string Username, out string Password, out string Database, out string ConnectAs)
1979 {
1980 IntPtr pUsername, pPassword, pConnectAs, pDatabase;
1981 bool result = _GETCONNECTIONINFOEX(ix, out pUsername, out pPassword, out pDatabase, out pConnectAs);
1982
1983 Username = Marshal.PtrToStringAnsi(pUsername);
1984 Password = Marshal.PtrToStringAnsi(pPassword);
1985 Database = Marshal.PtrToStringAnsi(pDatabase);
1986 ConnectAs = Marshal.PtrToStringAnsi(pConnectAs);
1987
1988 return result;
1989 }
1990
1991 /// <summary>
1992 /// Search in the available connections for a specific connection.
1993 /// </summary>
1994 /// <param name="Username"></param>
1995 /// <param name="Database"></param>
1996 /// <returns> Result will return -1 if not found, otherwise an index in the array as retrieved by GetConnectionInfoEx(). </returns>
1997 public int FindConnection(string Username, string Database)
1998 {
1999 return _FINDCONNECTION(Username, Database);
2000 /// <summary>
2001 ///
2002 /// </summary>
2003 }
2004
2005 /// <summary>
2006 /// This will connect the specified connection to the database. A logon dialog will appear if necessary for a password.
2007 /// </summary>
2008 public bool ConnectConnection(int ix)
2009 {
2010 return _CONNECTCONNECTION(ix);
2011 }
2012
2013 /// <summary>
2014 /// Makes the specified connection the main connection. The main connection is used by PL/SQL Developer for the object browser and as default connection for new windows.
2015 /// </summary>
2016 /// <param name="ix"></param>
2017 public bool SetMainConnection(int ix)
2018 {
2019 return _SETMAINCONNECTION(ix);
2020 }
2021
2022 /// <summary>
2023 /// Retrieves the connection used by the current window. Use GetConnectionInfoEx() to get details.
2024 /// </summary>
2025 public int GetWindowConnection()
2026 {
2027 return _GETWINDOWCONNECTION();
2028 }
2029
2030 /// <summary>
2031 /// Sets the connection for the current window.
2032 /// </summary>
2033 public bool SetWindowConnection()
2034 {
2035 return _SETWINDOWCONNECTION();
2036 }
2037
2038 /// <summary>
2039 /// Returns available connections. Use the ix parameter from 0 onwards to determine the connection until the function returns false.
2040 /// The ID and ParentID determine the parent child relation.
2041 /// </summary>
2042 public bool GetConnectionTree(int ix, out string Description, out string Username, out string Password, out string Database, out string ConnectAs, int ID, int ParentID)
2043 {
2044 IntPtr pDescription, pUsername, pPassword, pConnectAs, pDatabase;
2045 bool result = _GETCONNECTIONTREE(ix, out pDescription, out pUsername, out pPassword, out pDatabase, out pConnectAs, ID, ParentID);
2046
2047 Description = Marshal.PtrToStringAnsi(pDescription);
2048 Username = Marshal.PtrToStringAnsi(pUsername);
2049 Password = Marshal.PtrToStringAnsi(pPassword);
2050 Database = Marshal.PtrToStringAnsi(pDatabase);
2051 ConnectAs = Marshal.PtrToStringAnsi(pConnectAs);
2052
2053 return result;
2054 }
2055
2056 /// <summary>
2057 /// Extents function GetConnectionInfoEx for use with Edition and Workspace introduced in Version 10.
2058 /// </summary>
2059 public bool GetConnectionInfoEx10(int ix, out string Username, out string Password, out string Database, out string ConnectAs, out string Edition, out string Workspace)
2060 {
2061 IntPtr pUsername, pPassword, pConnectAs, pEdition, pDatabase, pWorkspace;
2062 bool result = _GETCONNECTIONINFOEX10(ix, out pUsername, out pPassword, out pDatabase, out pConnectAs, out pEdition, out pWorkspace);
2063
2064 Edition = Marshal.PtrToStringAnsi(pEdition);
2065 Username = Marshal.PtrToStringAnsi(pUsername);
2066 Password = Marshal.PtrToStringAnsi(pPassword);
2067 Database = Marshal.PtrToStringAnsi(pDatabase);
2068 ConnectAs = Marshal.PtrToStringAnsi(pConnectAs);
2069 Workspace = Marshal.PtrToStringAnsi(pWorkspace);
2070
2071 return result;
2072 }
2073
2074 /// <summary>
2075 /// Extents function FindConnection for use with Edition and Workspace introduced in Version 10.
2076 /// </summary>
2077 /// <param name="Username"></param>
2078 /// <param name="Database"></param>
2079 /// <param name="Edition"></param>
2080 /// <param name="Workspace"></param>
2081 /// <returns></returns>
2082 public int FindConnectionEx10(string Username, string Database, string Edition, string Workspace)
2083 {
2084 return _FINDCONNECTIONEX10(Username, Database, Edition, Workspace);
2085 }
2086
2087 /// <summary>
2088 /// Extents function AddConnection for use with Edition and Workspace introduced in Version 10.
2089 /// </summary>
2090 public int AddConnectionEx10(string Username, string Password, string Database, string ConnectAs, string Edition, string Workspace)
2091 {
2092 return _ADDCONNECTIONEX10(Username, Password, Database, ConnectAs, Edition, Workspace);
2093 }
2094
2095 /// <summary>
2096 /// Extents function GetConnectionTree for use with Edition and Workspace introduced in Version 10.
2097 /// </summary>
2098 /// <param name="ix"></param>
2099 /// <param name="Description"></param>
2100 /// <param name="Username"></param>
2101 /// <param name="Password"></param>
2102 /// <param name="Database"></param>
2103 /// <param name="ConnectAs"></param>
2104 /// <param name="Edition"></param>
2105 /// <param name="Workspace"></param>
2106 /// <param name="ID"></param>
2107 /// <param name="ParentID"></param>
2108 /// <returns></returns>
2109 public bool GetConnectionTreeEx10(int ix, out string Description, out string Username, out string Password, out string Database, out string ConnectAs, out string Edition, out string Workspace, int ID, int ParentID)
2110 {
2111 IntPtr pDescription, pUsername, pPassword, pConnectAs, pEdition, pDatabase, pWorkspace;
2112
2113 bool result = _GETCONNECTIONTREEEX10(ix, out pDescription, out pUsername, out pPassword, out pDatabase, out pConnectAs, out pEdition, out pWorkspace, ID, ParentID);
2114
2115 Edition = Marshal.PtrToStringAnsi(pEdition);
2116 Username = Marshal.PtrToStringAnsi(pUsername);
2117 Password = Marshal.PtrToStringAnsi(pPassword);
2118 Database = Marshal.PtrToStringAnsi(pDatabase);
2119 ConnectAs = Marshal.PtrToStringAnsi(pConnectAs);
2120 Workspace = Marshal.PtrToStringAnsi(pWorkspace);
2121 Description = Marshal.PtrToStringAnsi(pDescription);
2122
2123 return result;
2124 }
2125 #endregion
2126
2127 /// <summary>
2128 /// Call Back Funktionen für IDE
2129 /// </summary> <param name="index"></param> <param name="function"></param>
2130 public static void RegisterCallback(IdeType index, IntPtr function)
2131 {
2132 switch (index)
2133 {
2134 case IdeType.MENUSTATE:
2135 _MENUSTATE = (MENUSTATE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(MENUSTATE_DELEGATE));
2136 break;
2137 case IdeType.CONNECTED:
2138 _CONNECTED = (CONNECTED_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(CONNECTED_DELEGATE));
2139 break;
2140 case IdeType.GETCONNECTIONINFO:
2141 _GETCONNECTIONINFO = (GETCONNECTIONINFO_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETCONNECTIONINFO_DELEGATE));
2142 break;
2143 case IdeType.GETBROWSERINFO:
2144 _GETBROWSERINFO = (GETBROWSERINFO_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETBROWSERINFO_DELEGATE));
2145 break;
2146 case IdeType.GETWINDOWTYPE:
2147 _GETWINDOWTYPE = (GETWINDOWTYPE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETWINDOWTYPE_DELEGATE));
2148 break;
2149 case IdeType.GETAPPHANDLE:
2150 _GETAPPHANDLE = (GETAPPHANDLE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETAPPHANDLE_DELEGATE));
2151 break;
2152 case IdeType.GETWINDOWHANDLE:
2153 _GETWINDOWHANDLE = (GETWINDOWHANDLE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETWINDOWHANDLE_DELEGATE));
2154 break;
2155 case IdeType.GETCLIENTHANDLE:
2156 _GETCLIENTHANDLE = (GETCLIENTHANDLE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETCLIENTHANDLE_DELEGATE));
2157 break;
2158 case IdeType.GETCHILDHANDLE:
2159 _GETCHILDHANDLE = (GETCHILDHANDLE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETCHILDHANDLE_DELEGATE));
2160 break;
2161 case IdeType.REFRESH:
2162 _REFRESH = (REFRESH_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(REFRESH_DELEGATE));
2163 break;
2164 case IdeType.CREATEWINDOW:
2165 _CREATEWINDOW = (CREATEWINDOW_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(CREATEWINDOW_DELEGATE));
2166 break;
2167 case IdeType.OPENFILE:
2168 _OPENFILE = (OPENFILE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(OPENFILE_DELEGATE));
2169 break;
2170 case IdeType.SAVEFILE:
2171 _SAVEFILE = (SAVEFILE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SAVEFILE_DELEGATE));
2172 break;
2173 case IdeType.FILENAME:
2174 _FILENAME = (FILENAME_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(FILENAME_DELEGATE));
2175 break;
2176 case IdeType.CLOSEFILE:
2177 _CLOSEFILE = (CLOSEFILE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(CLOSEFILE_DELEGATE));
2178 break;
2179 case IdeType.SETREADONLY:
2180 _SETREADONLY = (SETREADONLY_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SETREADONLY_DELEGATE));
2181 break;
2182 case IdeType.GETREADONLY:
2183 _GETREADONLY = (GETREADONLY_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETREADONLY_DELEGATE));
2184 break;
2185 case IdeType.EXECUTESQLREPORT:
2186 _EXECUTESQLREPORT = (EXECUTESQLREPORT_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(EXECUTESQLREPORT_DELEGATE));
2187 break;
2188 case IdeType.RELOADFILE:
2189 _RELOADFILE = (RELOADFILE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(RELOADFILE_DELEGATE));
2190 break;
2191 case IdeType.SETFILENAME:
2192 _SETFILENAME = (SETFILENAME_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SETFILENAME_DELEGATE));
2193 break;
2194 case IdeType.GETTEXT:
2195 _GETTEXT = (GETTEXT_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETTEXT_DELEGATE));
2196 break;
2197 case IdeType.GETSELECTEDTEXT:
2198 _GETSELECTEDTEXT = (GETSELECTEDTEXT_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETSELECTEDTEXT_DELEGATE));
2199 break;
2200 case IdeType.GETCURSORWORD:
2201 _GETCURSORWORD = (GETCURSORWORD_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETCURSORWORD_DELEGATE));
2202 break;
2203 case IdeType.GETEDITORHANDLE:
2204 _GETEDITORHANDLE = (GETEDITORHANDLE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETEDITORHANDLE_DELEGATE));
2205 break;
2206 case IdeType.SETTEXT:
2207 _SETTEXT = (SETTEXT_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SETTEXT_DELEGATE));
2208 break;
2209 case IdeType.SETSTATUSMESSAGE:
2210 _SETSTATUSMESSAGE = (SETSTATUSMESSAGE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SETSTATUSMESSAGE_DELEGATE));
2211 break;
2212 case IdeType.SETERRORPOSITION:
2213 _SETERRORPOSITION = (SETERRORPOSITION_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SETERRORPOSITION_DELEGATE));
2214 break;
2215 case IdeType.CLEARERRORPOSITIONS:
2216 _CLEARERRORPOSITIONS = (CLEARERRORPOSITIONS_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(CLEARERRORPOSITIONS_DELEGATE));
2217 break;
2218 case IdeType.GETCURSORWORDPOSITION:
2219 _GETCURSORWORDPOSITION = (GETCURSORWORDPOSITION_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETCURSORWORDPOSITION_DELEGATE));
2220 break;
2221 case IdeType.PERFORM:
2222 _PERFORM = (PERFORM_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(PERFORM_DELEGATE));
2223 break;
2224 case IdeType.GETCUSTOMKEYWORDS:
2225 _GETCUSTOMKEYWORDS = (GETCUSTOMKEYWORDS_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETCUSTOMKEYWORDS_DELEGATE));
2226 break;
2227 case IdeType.SETCUSTOMKEYWORDS:
2228 _SETCUSTOMKEYWORDS = (SETCUSTOMKEYWORDS_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SETCUSTOMKEYWORDS_DELEGATE));
2229 break;
2230 case IdeType.SETKEYWORDS:
2231 _SETKEYWORDS = (SETKEYWORDS_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SETKEYWORDS_DELEGATE));
2232 break;
2233 case IdeType.ACTIVATEKEYWORDS:
2234 _ACTIVATEKEYWORDS = (ACTIVATEKEYWORDS_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(ACTIVATEKEYWORDS_DELEGATE));
2235 break;
2236 case IdeType.REFRESHMENUS:
2237 _REFRESHMENUS = (REFRESHMENUS_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(REFRESHMENUS_DELEGATE));
2238 break;
2239 case IdeType.SETMENUNAME:
2240 _SETMENUNAME = (SETMENUNAME_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SETMENUNAME_DELEGATE));
2241 break;
2242 case IdeType.SETMENUCHECK:
2243 _SETMENUCHECK = (SETMENUCHECK_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SETMENUCHECK_DELEGATE));
2244 break;
2245 case IdeType.SETMENUVISIBLE:
2246 _SETMENUVISIBLE = (SETMENUVISIBLE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SETMENUVISIBLE_DELEGATE));
2247 break;
2248 case IdeType.GETMENULAYOUT:
2249 _GETMENULAYOUT = (GETMENULAYOUT_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETMENULAYOUT_DELEGATE));
2250 break;
2251 case IdeType.CREATEPOPUPITEM:
2252 _CREATEPOPUPITEM = (CREATEPOPUPITEM_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(CREATEPOPUPITEM_DELEGATE));
2253 break;
2254 case IdeType.SETCONNECTION:
2255 _SETCONNECTION = (SETCONNECTION_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SETCONNECTION_DELEGATE));
2256 break;
2257 case IdeType.GETOBJECTINFO:
2258 _GETOBJECTINFO = (GETOBJECTINFO_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETOBJECTINFO_DELEGATE));
2259 break;
2260 case IdeType.GETBROWSERITEMS:
2261 _GETBROWSERITEMS = (GETBROWSERITEMS_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETBROWSERITEMS_DELEGATE));
2262 break;
2263 case IdeType.REFRESHBROWSER:
2264 _REFRESHBROWSER = (REFRESHBROWSER_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(REFRESHBROWSER_DELEGATE));
2265 break;
2266 case IdeType.GETPOPUPOBJECT:
2267 _GETPOPUPOBJECT = (GETPOPUPOBJECT_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETPOPUPOBJECT_DELEGATE));
2268 break;
2269 case IdeType.GETPOPUPBROWSERROOT:
2270 _GETPOPUPBROWSERROOT = (GETPOPUPBROWSERROOT_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETPOPUPBROWSERROOT_DELEGATE));
2271 break;
2272 case IdeType.REFRESHOBJECT:
2273 _REFRESHOBJECT = (REFRESHOBJECT_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(REFRESHOBJECT_DELEGATE));
2274 break;
2275 case IdeType.FIRSTSELECTEDOBJECT:
2276 _FIRSTSELECTEDOBJECT = (FIRSTSELECTEDOBJECT_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(FIRSTSELECTEDOBJECT_DELEGATE));
2277 break;
2278 case IdeType.NEXTSELECTEDOBJECT:
2279 _NEXTSELECTEDOBJECT = (NEXTSELECTEDOBJECT_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(NEXTSELECTEDOBJECT_DELEGATE));
2280 break;
2281 case IdeType.GETOBJECTSOURCE:
2282 _GETOBJECTSOURCE = (GETOBJECTSOURCE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETOBJECTSOURCE_DELEGATE));
2283 break;
2284 case IdeType.GETWINDOWCOUNT:
2285 _GETWINDOWCOUNT = (GETWINDOWCOUNT_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETWINDOWCOUNT_DELEGATE));
2286 break;
2287 case IdeType.SELECTWINDOW:
2288 _SELECTWINDOW = (SELECTWINDOW_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SELECTWINDOW_DELEGATE));
2289 break;
2290 case IdeType.ACTIVATEWINDOW:
2291 _ACTIVATEWINDOW = (ACTIVATEWINDOW_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(ACTIVATEWINDOW_DELEGATE));
2292 break;
2293 case IdeType.WINDOWISMODIFIED:
2294 _WINDOWISMODIFIED = (WINDOWISMODIFIED_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(WINDOWISMODIFIED_DELEGATE));
2295 break;
2296 case IdeType.WINDOWISRUNNING:
2297 _WINDOWISRUNNING = (WINDOWISRUNNING_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(WINDOWISRUNNING_DELEGATE));
2298 break;
2299 case IdeType.WINDOWPIN:
2300 _WINDOWPIN = (WINDOWPIN_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(WINDOWPIN_DELEGATE));
2301 break;
2302 case IdeType.SPLASHCREATE:
2303 _SPLASHCREATE = (SPLASHCREATE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SPLASHCREATE_DELEGATE));
2304 break;
2305 case IdeType.SPLASHHIDE:
2306 _SPLASHHIDE = (SPLASHHDELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SPLASHHDELEGATE));
2307 break;
2308 case IdeType.SPLASHWRITE:
2309 _SPLASHWRITE = (SPLASHWRITE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SPLASHWRITE_DELEGATE));
2310 break;
2311 case IdeType.SPLASHWRITELN:
2312 _SPLASHWRITELN = (SPLASHWRITELN_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SPLASHWRITELN_DELEGATE));
2313 break;
2314 case IdeType.SPLASHPROGRESS:
2315 _SPLASHPROGRESS = (SPLASHPROGRESS_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SPLASHPROGRESS_DELEGATE));
2316 break;
2317 case IdeType.TEMPLATEPATH:
2318 _TEMPLATEPATH = (TEMPLATEPATH_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(TEMPLATEPATH_DELEGATE));
2319 break;
2320 case IdeType.EXECUTETEMPLATE:
2321 _EXECUTETEMPLATE = (EXECUTETEMPLATE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(EXECUTETEMPLATE_DELEGATE));
2322 break;
2323 case IdeType.GETCONNECTAS:
2324 _GETCONNECTAS = (GETCONNECTAS_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETCONNECTAS_DELEGATE));
2325 break;
2326 case IdeType.SETCONNECTIONAS:
2327 _SETCONNECTIONAS = (SETCONNECTIONAS_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SETCONNECTIONAS_DELEGATE));
2328 break;
2329 case IdeType.GETFILEOPENMENU:
2330 _GETFILEOPENMENU = (GETFILEOPENMENU_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETFILEOPENMENU_DELEGATE));
2331 break;
2332 case IdeType.CANSAVEWINDOW:
2333 _CANSAVEWINDOW = (CANSAVEWINDOW_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(CANSAVEWINDOW_DELEGATE));
2334 break;
2335 case IdeType.OPENFILEEXTERNAL:
2336 _OPENFILEEXTERNAL = (OPENFILEEXTERNAL_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(OPENFILEEXTERNAL_DELEGATE));
2337 break;
2338 case IdeType.GETFILETYPES:
2339 _GETFILETYPES = (GETFILETYPES_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETFILETYPES_DELEGATE));
2340 break;
2341 case IdeType.GETDEFAULTEXTENSION:
2342 _GETDEFAULTEXTENSION = (GETDEFAULTEXTENSION_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETDEFAULTEXTENSION_DELEGATE));
2343 break;
2344 case IdeType.GETFILEDATA:
2345 _GETFILEDATA = (GETFILEDATA_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETFILEDATA_DELEGATE));
2346 break;
2347 case IdeType.FILESAVED:
2348 _FILESAVED = (FILESAVED_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(FILESAVED_DELEGATE));
2349 break;
2350 case IdeType.SHOWHTML:
2351 _SHOWHTML = (SHOWHTML_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SHOWHTML_DELEGATE));
2352 break;
2353 case IdeType.REFRESHHTML:
2354 _REFRESHHTML = (REFRESHHTML_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(REFRESHHTML_DELEGATE));
2355 break;
2356 case IdeType.GETPROCEDITEXTENSION:
2357 _GETPROCEDITEXTENSION = (GETPROCEDITEXTENSION_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETPROCEDITEXTENSION_DELEGATE));
2358 break;
2359 case IdeType.GETWINDOWOBJECT:
2360 _GETWINDOWOBJECT = (GETWINDOWOBJECT_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETWINDOWOBJECT_DELEGATE));
2361 break;
2362 case IdeType.FIRSTSELECTEDFILE:
2363 _FIRSTSELECTEDFILE = (FIRSTSELECTEDFILE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(FIRSTSELECTEDFILE_DELEGATE));
2364 break;
2365 case IdeType.NEXTSELECTEDFILE:
2366 _NEXTSELECTEDFILE = (NEXTSELECTEDFILE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(NEXTSELECTEDFILE_DELEGATE));
2367 break;
2368 case IdeType.REFRESHFILEBROWSER:
2369 _REFRESHFILEBROWSER = (REFRESHFILEBROWSER_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(REFRESHFILEBROWSER_DELEGATE));
2370 break;
2371 case IdeType.KEYPRESS:
2372 _KEYPRESS = (KEYPRESS_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(KEYPRESS_DELEGATE));
2373 break;
2374 case IdeType.GETMENUITEM:
2375 _GETMENUITEM = (GETMENUITEM_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETMENUITEM_DELEGATE));
2376 break;
2377 case IdeType.SELECTMENU:
2378 _SELECTMENU = (SELECTMENU_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SELECTMENU_DELEGATE));
2379 break;
2380 case IdeType.TRANSLATIONFILE:
2381 _TRANSLATIONFILE = (TRANSLATIONFILE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(TRANSLATIONFILE_DELEGATE));
2382 break;
2383 case IdeType.TRANSLATIONLANGUAGE:
2384 _TRANSLATIONLANGUAGE = (TRANSLATIONLANGUAGE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(TRANSLATIONLANGUAGE_DELEGATE));
2385 break;
2386 case IdeType.GETTRANSLATEDMENULAYOUT:
2387 _GETTRANSLATEDMENULAYOUT = (GETTRANSLATEDMENULAYOUT_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETTRANSLATEDMENULAYOUT_DELEGATE));
2388 break;
2389 case IdeType.MAINFONT:
2390 _MAINFONT = (MAINFONT_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(MAINFONT_DELEGATE));
2391 break;
2392 case IdeType.TRANSLATEITEMS:
2393 _TRANSLATEITEMS = (TRANSLATEITEMS_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(TRANSLATEITEMS_DELEGATE));
2394 break;
2395 case IdeType.TRANSLATESTRING:
2396 _TRANSLATESTRING = (TRANSLATESTRING_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(TRANSLATESTRING_DELEGATE));
2397 break;
2398 case IdeType.SAVERECOVERYFILES:
2399 _SAVERECOVERYFILES = (SAVERECOVERYFILES_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SAVERECOVERYFILES_DELEGATE));
2400 break;
2401 case IdeType.GETCURSORX:
2402 _GETCURSORX = (GETCURSORX_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETCURSORX_DELEGATE));
2403 break;
2404 case IdeType.GETCURSORY:
2405 _GETCURSORY = (GETCURSORY_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETCURSORY_DELEGATE));
2406 break;
2407 case IdeType.SETCURSOR:
2408 _SETCURSOR = (SETCURSOR_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SETCURSOR_DELEGATE));
2409 break;
2410 case IdeType.SETBOOKMARK:
2411 _SETBOOKMARK = (SETBOOKMARK_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SETBOOKMARK_DELEGATE));
2412 break;
2413 case IdeType.CLEARBOOKMARK:
2414 _CLEARBOOKMARK = (CLEARBOOKMARK_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(CLEARBOOKMARK_DELEGATE));
2415 break;
2416 case IdeType.GOTOBOOKMARK:
2417 _GOTOBOOKMARK = (GOTOBOOKMARK_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GOTOBOOKMARK_DELEGATE));
2418 break;
2419 case IdeType.GETBOOKMARK:
2420 _GETBOOKMARK = (GETBOOKMARK_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETBOOKMARK_DELEGATE));
2421 break;
2422 case IdeType.TABINFO:
2423 _TABINFO = (TABINFO_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(TABINFO_DELEGATE));
2424 break;
2425 case IdeType.TABINDEX:
2426 _TABINDEX = (TABINDEX_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(TABINDEX_DELEGATE));
2427 break;
2428 case IdeType.CREATETOOLBUTTON:
2429 _CREATETOOLBUTTON = (CREATETOOLBUTTON_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(CREATETOOLBUTTON_DELEGATE));
2430 break;
2431 case IdeType.WINDOWHASEDITOR:
2432 _WINDOWHASEDITOR = (WINDOWHASEDITOR_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(WINDOWHASEDITOR_DELEGATE));
2433 break;
2434 case IdeType.BEAUTIFIEROPTIONS:
2435 _BEAUTIFIEROPTIONS = (BEAUTIFIEROPTIONS_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(BEAUTIFIEROPTIONS_DELEGATE));
2436 break;
2437 case IdeType.BEAUTIFYWINDOW:
2438 _BEAUTIFYWINDOW = (BEAUTIFYWINDOW_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(BEAUTIFYWINDOW_DELEGATE));
2439 break;
2440 case IdeType.BEAUTIFYTEXT:
2441 _BEAUTIFYTEXT = (BEAUTIFYTEXT_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(BEAUTIFYTEXT_DELEGATE));
2442 break;
2443 case IdeType.OBJECTACTION:
2444 _OBJECTACTION = (OBJECTACTION_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(OBJECTACTION_DELEGATE));
2445 break;
2446 case IdeType.SHOWDIALOG:
2447 _SHOWDIALOG = (SHOWDIALOG_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SHOWDIALOG_DELEGATE));
2448 break;
2449 case IdeType.DEBUGLOG:
2450 _DEBUGLOG = (DEBUGLOG_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(DEBUGLOG_DELEGATE));
2451 break;
2452 case IdeType.GETPARAMSTRING:
2453 _GETPARAMSTRING = (GETPARAMSTRING_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETPARAMSTRING_DELEGATE));
2454 break;
2455 case IdeType.GETPARAMBOOL:
2456 _GETPARAMBOOL = (GETPARAMBOOL_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETPARAMBOOL_DELEGATE));
2457 break;
2458 case IdeType.GETBROWSERFILTER:
2459 _GETBROWSERFILTER = (GETBROWSERFILTER_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETBROWSERFILTER_DELEGATE));
2460 break;
2461 case IdeType.COMMANDFEEDBACK:
2462 _COMMANDFEEDBACK = (COMMANDFEEDBACK_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(COMMANDFEEDBACK_DELEGATE));
2463 break;
2464 case IdeType.RESULTGRIDROWCOUNT:
2465 _RESULTGRIDROWCOUNT = (RESULTGRIDROWCOUNT_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(RESULTGRIDROWCOUNT_DELEGATE));
2466 break;
2467 case IdeType.RESULTGRIDCOLCOUNT:
2468 _RESULTGRIDCOLCOUNT = (RESULTGRIDCOLCOUNT_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(RESULTGRIDCOLCOUNT_DELEGATE));
2469 break;
2470 case IdeType.RESULTGRIDCELL:
2471 _RESULTGRIDCELL = (RESULTGRIDCELL_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(RESULTGRIDCELL_DELEGATE));
2472 break;
2473 case IdeType.AUTHORIZED:
2474 _AUTHORIZED = (AUTHORIZED_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(AUTHORIZED_DELEGATE));
2475 break;
2476 case IdeType.WINDOWALLOWED:
2477 _WINDOWALLOWED = (WINDOWALLOWED_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(WINDOWALLOWED_DELEGATE));
2478 break;
2479 case IdeType.AUTHORIZATION:
2480 _AUTHORIZATION = (AUTHORIZATION_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(AUTHORIZATION_DELEGATE));
2481 break;
2482 case IdeType.AUTHORIZATIONITEMS:
2483 _AUTHORIZATIONITEMS = (AUTHORIZATIONITEMS_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(AUTHORIZATIONITEMS_DELEGATE));
2484 break;
2485 case IdeType.ADDAUTHORIZATIONITEM:
2486 _ADDAUTHORIZATIONITEM = (ADDAUTHORIZATIONITEM_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(ADDAUTHORIZATIONITEM_DELEGATE));
2487 break;
2488 case IdeType.GETPERSONALPREFSETS:
2489 _GETPERSONALPREFSETS = (GETPERSONALPREFSETS_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETPERSONALPREFSETS_DELEGATE));
2490 break;
2491 case IdeType.GETDEFAULTPREFSETS:
2492 _GETDEFAULTPREFSETS = (GETDEFAULTPREFSETS_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETDEFAULTPREFSETS_DELEGATE));
2493 break;
2494 case IdeType.GETPREFASSTRING:
2495 _GETPREFASSTRING = (GETPREFASSTRING_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETPREFASSTRING_DELEGATE));
2496 break;
2497 case IdeType.GETPREFASINTEGER:
2498 _GETPREFASINTEGER = (GETPREFASINTEGER_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETPREFASINTEGER_DELEGATE));
2499 break;
2500 case IdeType.GETPREFASBOOL:
2501 _GETPREFASBOOL = (GETPREFASBOOL_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETPREFASBOOL_DELEGATE));
2502 break;
2503 case IdeType.SETPREFASSTRING:
2504 _SETPREFASSTRING = (SETPREFASSTRING_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SETPREFASSTRING_DELEGATE));
2505 break;
2506 case IdeType.SETPREFASINTEGER:
2507 _SETPREFASINTEGER = (SETPREFASINTEGER_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SETPREFASINTEGER_DELEGATE));
2508 break;
2509 case IdeType.SETPREFASBOOL:
2510 _SETPREFASBOOL = (SETPREFASBOOL_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SETPREFASBOOL_DELEGATE));
2511 break;
2512 case IdeType.GETGENERALPREF:
2513 _GETGENERALPREF = (GETGENERALPREF_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETGENERALPREF_DELEGATE));
2514 break;
2515 case IdeType.PLUGINSETTING:
2516 _PLUGINSETTING = (PLUGINSETTING_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(PLUGINSETTING_DELEGATE));
2517 break;
2518 case IdeType.GETPROCOVERLOADCOUNT:
2519 _GETPROCOVERLOADCOUNT = (GETPROCOVERLOADCOUNT_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETPROCOVERLOADCOUNT_DELEGATE));
2520 break;
2521 case IdeType.SELECTPROCOVERLOADING:
2522 _SELECTPROCOVERLOADING = (SELECTPROCOVERLOADING_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SELECTPROCOVERLOADING_DELEGATE));
2523 break;
2524 case IdeType.GETSESSIONVALUE:
2525 _GETSESSIONVALUE = (GETSESSIONVALUE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETSESSIONVALUE_DELEGATE));
2526 break;
2527 case IdeType.CHECKDBVERSION:
2528 _CHECKDBVERSION = (CHECKDBVERSION_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(CHECKDBVERSION_DELEGATE));
2529 break;
2530 case IdeType.GETCONNECTIONINFOEX:
2531 _GETCONNECTIONINFOEX = (GETCONNECTIONINFOEX_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETCONNECTIONINFOEX_DELEGATE));
2532 break;
2533 case IdeType.FINDCONNECTION:
2534 _FINDCONNECTION = (FINDCONNECTION_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(FINDCONNECTION_DELEGATE));
2535 break;
2536 case IdeType.ADDCONNECTION:
2537 _ADDCONNECTION = (ADDCONNECTION_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(ADDCONNECTION_DELEGATE));
2538 break;
2539 case IdeType.CONNECTCONNECTION:
2540 _CONNECTCONNECTION = (CONNECTCONNECTION_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(CONNECTCONNECTION_DELEGATE));
2541 break;
2542 case IdeType.SETMAINCONNECTION:
2543 _SETMAINCONNECTION = (SETMAINCONNECTION_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SETMAINCONNECTION_DELEGATE));
2544 break;
2545 case IdeType.GETWINDOWCONNECTION:
2546 _GETWINDOWCONNECTION = (GETWINDOWCONNECTION_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETWINDOWCONNECTION_DELEGATE));
2547 break;
2548 case IdeType.SETWINDOWCONNECTION:
2549 _SETWINDOWCONNECTION = (SETWINDOWCONNECTION_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SETWINDOWCONNECTION_DELEGATE));
2550 break;
2551 case IdeType.GETCONNECTIONTREE:
2552 _GETCONNECTIONTREE = (GETCONNECTIONTREE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETCONNECTIONTREE_DELEGATE));
2553 break;
2554 case IdeType.GETCONNECTIONINFOEX10:
2555 _GETCONNECTIONINFOEX10 = (GETCONNECTIONINFOEX10_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETCONNECTIONINFOEX10_DELEGATE));
2556 break;
2557 case IdeType.FINDCONNECTIONEX10:
2558 _FINDCONNECTIONEX10 = (FINDCONNECTIONEX10_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(FINDCONNECTIONEX10_DELEGATE));
2559 break;
2560 case IdeType.ADDCONNECTIONEX10:
2561 _ADDCONNECTIONEX10 = (ADDCONNECTIONEX10_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(ADDCONNECTIONEX10_DELEGATE));
2562 break;
2563 case IdeType.GETCONNECTIONTREEEX10:
2564 _GETCONNECTIONTREEEX10 = (GETCONNECTIONTREEEX10_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETCONNECTIONTREEEX10_DELEGATE));
2565 break;
2566 }
2567 }
2568 }
2569
2570 public class SQL
2571 {
2572 public enum SqlType
2573 {
2574 EXECUTE = 40,
2575 FIELDCOUNT = 41,
2576 EOF = 42,
2577 NEXT = 43,
2578 FIELD = 44,
2579 FIELDNAME = 45,
2580 FIELDINDEX = 46,
2581 FIELDTYPE = 47,
2582 ERRORMESSAGE = 48,
2583 USEPLUGINSESSION = 50,
2584 USEDEFAULTSESSION = 51,
2585 CHECKCONNECTION = 52,
2586 GETDBMSGETOUTPUT = 53,
2587 SETVARIABLE = 54,
2588 GETVARIABLE = 55,
2589 CLEARVARIABLES = 56,
2590 SETPLUGINSESSION = 57
2591 }
2592
2593 #region Delegates
2594 private delegate int EXECUTE_DELEGATE(string SQL);
2595 private delegate int FIELDCOUNT_DELEGATE();
2596 [return: MarshalAs(UnmanagedType.Bool)]
2597 private delegate bool EOF_DELEGATE();
2598 private delegate int NEXT_DELEGATE();
2599 private delegate IntPtr FIELD_DELEGATE(int Field);
2600 private delegate IntPtr FIELDNAME_DELEGATE(int Field);
2601 private delegate int FIELDINDEX_DELEGATE(string Name);
2602 [return: MarshalAs(UnmanagedType.Bool)]
2603 private delegate bool USEPLUGINSESSION_DELEGATE(int PlugInID);
2604 private delegate void USEDEFAULTSESSION_DELEGATE(int PlugInID);
2605 [return: MarshalAs(UnmanagedType.Bool)]
2606 private delegate bool CHECKCONNECTION_DELEGATE();
2607 private delegate IntPtr GETDBMSGETOUTPUT_DELEGATE();
2608 private delegate void SETVARIABLE_DELEGATE(string Name, string Value);
2609 private delegate IntPtr GETVARIABLE_DELEGATE(string Name);
2610 private delegate void CLEARVARIABLES_DELEGATE();
2611 [return: MarshalAs(UnmanagedType.Bool)]
2612 private delegate bool SETPLUGINSESSION_DELEGATE(int PlugInID, string Username, string Password, string Database, string ConnectAs);
2613 private delegate int FIELDTYPE_DELEGATE(int Field);
2614 private delegate IntPtr ERRORMESSAGE_DELEGATE();
2615 #endregion
2616
2617 #region vars
2618 private static EXECUTE_DELEGATE _EXECUTE;
2619 private static FIELDCOUNT_DELEGATE _FIELDCOUNT;
2620 private static EOF_DELEGATE _EOF;
2621 private static NEXT_DELEGATE _NEXT;
2622 private static FIELD_DELEGATE _FIELD;
2623 private static FIELDNAME_DELEGATE _FIELDNAME;
2624 private static FIELDINDEX_DELEGATE _FIELDINDEX;
2625 private static USEPLUGINSESSION_DELEGATE _USEPLUGINSESSION;
2626 private static USEDEFAULTSESSION_DELEGATE _USEDEFAULTSESSION;
2627 private static CHECKCONNECTION_DELEGATE _CHECKCONNECTION;
2628 private static GETDBMSGETOUTPUT_DELEGATE _GETDBMSGETOUTPUT;
2629 private static SETVARIABLE_DELEGATE _SETVARIABLE;
2630 private static GETVARIABLE_DELEGATE _GETVARIABLE;
2631 private static CLEARVARIABLES_DELEGATE _CLEARVARIABLES;
2632 private static SETPLUGINSESSION_DELEGATE _SETPLUGINSESSION;
2633 private static FIELDTYPE_DELEGATE _FIELDTYPE;
2634 private static ERRORMESSAGE_DELEGATE _ERRORMESSAGE;
2635 #endregion
2636
2637 #region methods
2638 /// <summary>
2639 /// Executes the statement defined in the SQL parameter. The function returns 0 if successful, else the Oracle error number.
2640 /// </summary>
2641 public int Execute(string SQL)
2642 {
2643 return _EXECUTE(SQL);
2644 }
2645
2646 /// <summary>
2647 /// Returns the number of fields after a Execute.
2648 /// </summary>
2649 public int FieldCount()
2650 {
2651 return _FIELDCOUNT();
2652 }
2653
2654 /// <summary>
2655 /// Returns if there are any more rows to fetch.
2656 /// </summary>
2657 public bool Eof()
2658 {
2659 return _EOF();
2660 }
2661
2662 /// <summary>
2663 /// Returns the next row after a Execute. The function returns 0 if successful, else the Oracle Error number
2664 /// </summary>
2665 public int Next()
2666 {
2667 return _NEXT();
2668 }
2669
2670 /// <summary>
2671 /// Returns the field specified by the Field parameter.
2672 /// </summary>
2673 public string Field(int Field)
2674 {
2675 return Marshal.PtrToStringAnsi(_FIELD(Field));
2676 }
2677
2678 /// <summary>
2679 /// Returns the fieldname specified by the Field parameter.
2680 /// </summary>
2681 public string FieldName(int Field)
2682 {
2683 return Marshal.PtrToStringAnsi(_FIELDNAME(Field));
2684 }
2685
2686 /// <summary>
2687 /// Converts a fieldname into an index, which can be used in the Field, FieldName and FieldType functions. If the field does not exist, the return value is -1.
2688 /// </summary>
2689 public int FieldIndex(string Name)
2690 {
2691 return _FIELDINDEX(Name);
2692 }
2693
2694 /// <summary>
2695 /// Normally, the SQL functions will use the main PL/SQL Developer Oracle session. If you want to make sure you don’t interfere with other transactions, and you want the PlugIn to use a private session, call this function.
2696 /// </summary>
2697 public bool UsePlugInSession(int PlugInID)
2698 {
2699 return _USEPLUGINSESSION(PlugInID);
2700 }
2701
2702 /// <summary>
2703 /// This function will cancel the previous function and set the Oracle session back to default.
2704 /// </summary>
2705 public void UseDefaultSession(int PlugInID)
2706 {
2707 _USEDEFAULTSESSION(PlugInID);
2708 }
2709
2710 /// <summary>
2711 /// Forces PL/SQL Developer to check if the current connection to the database is still open (and tries a re-connect if necessary). The return value indicates if there is a connection.
2712 /// </summary>
2713 public bool CheckConnection()
2714 {
2715 return _CHECKCONNECTION();
2716 }
2717
2718 /// <summary>
2719 /// Returns sys.dbms_output for the current (PlugIn specific) session.
2720 /// </summary>
2721 public string GetDBMSGetOutput()
2722 {
2723 return Marshal.PtrToStringAnsi(_GETDBMSGETOUTPUT());
2724 }
2725
2726 /// <summary>
2727 /// This function declares a variable. Call this for al variables you use in the statement you pass in Execute.
2728 /// </summary>
2729 public void SetVariable(string Name, string Value)
2730 {
2731 _SETVARIABLE(Name, Value);
2732 }
2733
2734 /// <summary>
2735 /// This function will return the value of a variable. Available in version 700
2736 /// </summary>
2737 public string GetVariable(string Name)
2738 {
2739 return Marshal.PtrToStringAnsi(_GETVARIABLE(Name));
2740 }
2741
2742 /// <summary>
2743 /// Clear all declared variables. If you are finished doing a query it is a good idea to call this function to prevent errors for the next execute. Available in version 700
2744 /// </summary>
2745 public void ClearVariables()
2746 {
2747 _CLEARVARIABLES();
2748 }
2749
2750 /// <summary>
2751 /// This function allows you to specify the connection details used for the SQL functions for the PlugIn. If your Plug-In has a specific task for the current window, you can get the connection details with the GetWindowConnection() and GetConnectionInfoEx() functions. The return value indicates if the function succeeded.
2752 /// </summary>
2753 public bool SetPlugInSession(int PlugInID, string Username, string Password, string Database, string ConnectAs)
2754 {
2755 return _SETPLUGINSESSION(PlugInID, Username, Password, Database, ConnectAs);
2756 }
2757
2758 /// <summary>
2759 /// Return the fieldtype of a field. 3 = otInteger 4 = otFloat 5 = otString 8 = otLong 12 = otDate 24 = otLongRaw
2760 /// </summary>
2761 public int FieldType(int Field)
2762 {
2763 return _FIELDTYPE(Field);
2764 }
2765
2766 /// <summary>
2767 /// This function will return the error message for any error that occurred during: Execute, Eof, Next, SetConnection, Available in version 301
2768 /// </summary>
2769 public string ErrorMessage()
2770 {
2771 return Marshal.PtrToStringAnsi(_ERRORMESSAGE());
2772 }
2773 #endregion
2774
2775 /// <summary>
2776 /// Call Back Funktionen für SQL
2777 /// </summary> <param name="index"></param> <param name="function"></param>
2778 public static void RegisterCallback(SqlType index, IntPtr function)
2779 {
2780 switch (index)
2781 {
2782 case SqlType.EXECUTE:
2783 _EXECUTE = (EXECUTE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(EXECUTE_DELEGATE));
2784 break;
2785 case SqlType.FIELDCOUNT:
2786 _FIELDCOUNT = (FIELDCOUNT_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(FIELDCOUNT_DELEGATE));
2787 break;
2788 case SqlType.EOF:
2789 _EOF = (EOF_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(EOF_DELEGATE));
2790 break;
2791 case SqlType.NEXT:
2792 _NEXT = (NEXT_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(NEXT_DELEGATE));
2793 break;
2794 case SqlType.FIELD:
2795 _FIELD = (FIELD_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(FIELD_DELEGATE));
2796 break;
2797 case SqlType.FIELDNAME:
2798 _FIELDNAME = (FIELDNAME_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(FIELDNAME_DELEGATE));
2799 break;
2800 case SqlType.FIELDINDEX:
2801 _FIELDINDEX = (FIELDINDEX_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(FIELDINDEX_DELEGATE));
2802 break;
2803 case SqlType.FIELDTYPE:
2804 _FIELDTYPE = (FIELDTYPE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(FIELDTYPE_DELEGATE));
2805 break;
2806 case SqlType.ERRORMESSAGE:
2807 _ERRORMESSAGE = (ERRORMESSAGE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(ERRORMESSAGE_DELEGATE));
2808 break;
2809 case SqlType.USEPLUGINSESSION:
2810 _USEPLUGINSESSION = (USEPLUGINSESSION_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(USEPLUGINSESSION_DELEGATE));
2811 break;
2812 case SqlType.USEDEFAULTSESSION:
2813 _USEDEFAULTSESSION = (USEDEFAULTSESSION_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(USEDEFAULTSESSION_DELEGATE));
2814 break;
2815 case SqlType.CHECKCONNECTION:
2816 _CHECKCONNECTION = (CHECKCONNECTION_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(CHECKCONNECTION_DELEGATE));
2817 break;
2818 case SqlType.GETDBMSGETOUTPUT:
2819 _GETDBMSGETOUTPUT = (GETDBMSGETOUTPUT_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETDBMSGETOUTPUT_DELEGATE));
2820 break;
2821 case SqlType.SETVARIABLE:
2822 _SETVARIABLE = (SETVARIABLE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SETVARIABLE_DELEGATE));
2823 break;
2824 case SqlType.GETVARIABLE:
2825 _GETVARIABLE = (GETVARIABLE_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(GETVARIABLE_DELEGATE));
2826 break;
2827 case SqlType.CLEARVARIABLES:
2828 _CLEARVARIABLES = (CLEARVARIABLES_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(CLEARVARIABLES_DELEGATE));
2829 break;
2830 case SqlType.SETPLUGINSESSION:
2831 _SETPLUGINSESSION = (SETPLUGINSESSION_DELEGATE)Marshal.GetDelegateForFunctionPointer(function, typeof(SETPLUGINSESSION_DELEGATE));
2832 break;
2833
2834 }
2835 }
2836
2837 }
2838 }
2839}