数学建模社区-数学中国

标题: ASP中令人震撼的Debug类(VBScript) [打印本页]

作者: 韩冰    时间: 2004-11-21 11:43
标题: ASP中令人震撼的Debug类(VBScript)
<>不知道用ASP写代码的朋友是不是和我有一样的感受,ASP中最头疼的就是调试程序的时候不方便,我想可能很多朋友都会用这样的方法“response.write ”,然后输出相关的语句来看看是否正确。前几天写了一个千行的页面,里面大概有七八个SUB/FUNCTION,调试的时候用了有三十几个response.write ,天,调试完后把这三十个一个个删除,累! </P>
6 R$ p: _9 o- c6 _  d- Y<>今天看到一个ASP中的Debug类(VBS),试用了一下,绝! 6 b; g9 v+ H1 X( y/ ~: O
使用方法很简单: : X- J% S, k$ Z' ^" z
test.asp </P># y/ I( w2 O7 \- w' E4 u) \4 W0 s
<>&lt;!--#INCLUDE FILE="debuggingConsole.asp"--&gt;
$ C1 P4 b5 s4 {9 G- [) O1 v( X&lt;% 1 C& x2 C& r5 y0 b/ T9 d
output="XXXX" 1 G" V$ v" U0 K4 V% ]; g
Set debugstr = New debuggingConsole $ D$ q0 W4 o" |2 O2 c
debugstr.Enabled = true , A6 Z6 s2 n9 U/ ?7 v3 m/ ?
   debugstr.Print "参数output的值", output
: U- w* y  i2 T4 C   '…… 7 L( z8 [1 I  b: U! v9 S
   debugstr.draw . U2 Q4 J6 N) p) k# d- L
Set debugstr = Nothing 7 A& Y& C/ W4 v& k; |, L
%&gt; </P>$ v, p0 i- ~: ~* {( v
<>=================================================== </P>
, d4 S2 e$ s; g3 m& i; f, T  k5 [<>debuggingConsole.asp </P>* e* m8 J. m7 K# m6 p  \. @" Z0 m
<>&lt;% : v6 Z! Z* o8 z" Q
Class debuggingConsole </P>
7 u0 T# j/ q; _7 i& r<>   private dbg_Enabled 0 S- v0 n) L1 @& D6 n
   private dbg_Show
( L  F: s" M7 O8 A' J3 _   private dbg_RequestTime
2 z% V; B/ T5 }0 R% D   private dbg_FinishTime , S) D; I" ^" D+ v
   private dbg_Data
" T/ k3 n; o% Y; D+ R' V3 Y7 V0 o( @   private dbg_DB_Data
& t& M& m+ `7 ^: l   private dbg_AllVars # \' X% O$ p' `1 u# A' r& L: z( o. n
   private dbg_Show_default 8 V8 L. x. k5 d& N3 e: u
   private DivSets(2)
+ W; t/ K( Z  J% b& G. g   9 m- H& l; \  M  a& C* [0 O
'Construktor =&gt; set the default values $ K4 y# m9 e$ f1 k, a) J  m. I* L: x+ F
Private Sub Class_Initialize()
1 A  d2 T+ G& A# m% e4 \   dbg_RequestTime = Now() 9 e( a0 k+ _9 t! P: q
   dbg_AllVars = false - b( s$ ?8 {" a
   Set dbg_Data = Server.CreateObject("Scripting.Dictionary") </P>" g( r0 Z; @& `! D3 f, r" ^# C, n
<>DivSets(0) = "&lt;TR&gt;&lt;TD style='cursor:hand;' onclick=""javascript:if (document.getElementById('data#sectname#').style.display=='none'){document.getElementById('data#sectname#').style.display='block';}else{document.getElementById('data#sectname#').style.display='none';}""&gt;&lt;DIV id=sect#sectname# style=""font-weight:bold;cursor:hand;background:#7EA5D7;color:white;padding-left:4;padding-right:4;padding-bottom:2;""&gt;|#title#| &lt;DIV id=data#sectname# style=""cursor:text;display:none;background:#FFFFFF;padding-left:8;"" onclick=""window.event.cancelBubble = true;""&gt;|#data#| &lt;/DIV&gt;|&lt;/DIV&gt;|" </P>
& |7 m( S0 T! |# }; P  r3 I/ h5 P! T% O<>   DivSets(1) = "&lt;TR&gt;&lt;TD&gt;! y! Q" F* F- d3 f
&lt;DIV id=sect#sectname# style=""font-weight:bold;cursor:hand;background:#7EA5D7;color:white;padding-left:4;padding-right:4;padding-bottom:2;"" onclick=""javascript:if (document.getElementById('data#sectname#').style.display=='none'){document.getElementById('data#sectname#').style.display='block';}else{document.getElementById('data#sectname#').style.display='none';}""&gt;|#title#| &lt;DIV id=data#sectname# style=""cursor:text;display:block;background:#FFFFFF;padding-left:8;"" onclick=""window.event.cancelBubble = true;""&gt;|#data#| &lt;/DIV&gt;|&lt;/DIV&gt;|" </P>
" D6 Y$ J5 d- W3 d! `3 J4 l- y<>   DivSets(2) = "&lt;TR&gt;&lt;TD&gt;&lt;DIV id=sect#sectname# style=""background:#7EA5D7;color:lightsteelblue;padding-left:4;padding-right:4;padding-bottom:2;""&gt;|#title#| &lt;DIV id=data#sectname# style=""display:none;background:lightsteelblue;padding-left:8""&gt;|#data#| &lt;/DIV&gt;|&lt;/DIV&gt;|" </P>
, V1 @* e/ J. Y5 L<>   dbg_Show_default = "0,0,0,0,0,0,0,0,0,0,0" , b6 d+ z4 C. y$ g9 A2 Z0 l2 v
End Sub </P>* v  @% M3 [- o, M4 U0 W/ P
<>ublic Property Let Enabled(bNewValue) ''[bool] Sets "enabled" to true or false
$ e$ l& _" E4 _% b( z2 A   dbg_Enabled = bNewValue . a3 c3 X3 U6 v4 C1 B( U& v. X
End Property </P>1 P6 @( S- }+ u# ]( d) H$ W
<>ublic Property Get Enabled ''[bool] Gets the "enabled" value - d9 \- p8 C5 l8 ^: w$ U, `
   Enabled = dbg_Enabled
3 f: J8 F% G1 O7 f+ B" ^End Property </P>8 T  C1 Y. C5 R# J* @9 Q5 E3 Y' R( I
<>ublic Property Let Show(bNewValue) ''[string] Sets the debugging panel. Where each digit in the string represents a debug information pane in order (11 of them). 1=open, 0=closed
; g$ _8 S! O, y   dbg_Show = bNewValue
  @, |- B& N% r$ h, G3 aEnd Property </P>
. T* ^9 o6 f7 D; K2 n0 D4 o& N<>ublic Property Get Show ''[string] Gets the debugging panel.
8 q5 O8 `9 P6 m( p2 n$ b   Show = dbg_Show ' c$ m6 ^8 N' l# w" V/ j( m( I
End Property </P>; k- x3 b1 ^. I; F
<>ublic Property Let AllVars(bNewValue) ''[bool] Sets wheather all variables will be displayed or not. true/false
/ L: v* ~# T9 i6 O5 ?& [   dbg_AllVars = bNewValue ! O5 D9 c7 }- C9 h: s# ?" D
End Property </P>  X' e* p: c. Q+ S3 k- }) y& U
<>ublic Property Get AllVars ''[bool] Gets if all variables will be displayed. ' i* f" R2 Y0 W
   AllVars = dbg_AllVars ( ]  M/ G: I1 d  {; ?6 X8 c& ~3 L
End Property </P>) ^0 O1 B$ d* Z/ {4 a: J6 Z. u1 f
<>'***********************************************************
, Y0 S* M# w3 M6 Q) m" V) e* }''@SDESCRIPTION: Adds a variable to the debug-informations.
8 V) S6 w# p6 I9 o. O5 m7 F3 `5 K4 Q''@PARAM:  - label [string]: Description of the variable 0 A  K- J2 ?  S' r, G
''@PARAM:  - output [variable]: The variable itself
' m. Z2 }& g7 P( u. x'*********************************************************** - I4 i: N' b2 Z  n" e6 a/ S- P
Public Sub Print(label, output) ( j; \' R' ?; ]5 k
   If dbg_Enabled Then
% B2 E% m: R/ b& Y) a2 w     if err.number &gt; 0 then & u* h* E+ e5 N' z( H$ F  s
       call dbg_Data.Add(ValidLabel(label), "!!! Error: " &amp; err.number &amp; " " &amp; err.Description) ; f# `  u9 M5 T
       err.Clear
. C$ L1 O8 P$ T2 p3 F; k     else . q6 ]' E, M( q# b; @' {; l  \
       uniqueID = ValidLabel(label) . j2 V. V* r9 a0 j. A1 j: G) d
       response.write uniqueID
. K& p4 T+ p7 z- X       call dbg_Data.Add(uniqueID, output) , Q, t! P2 U7 W, I' u
     end if
9 ?' F# ~! |5 g4 y7 X   End If - H; `3 K9 K" u2 [, s
End Sub 2 j8 [2 i5 u, @4 S# _' ?4 ^
  " {7 a: S) ^+ z  q
'*********************************************************** 5 C; K! m+ c3 I+ ^! y$ k0 X$ b' E
'* ValidLabel . L- y  i% H: J& \% s
'***********************************************************
, C7 }3 g: {; u7 S9 h0 ?Private Function ValidLabel(byval label) 4 b( @: W% E5 V5 Z: F3 q8 L
   dim i, lbl ' ^& i: t) H. q" x7 S
   i = 0 1 e( C" G/ f; r1 V* ^5 F
   lbl = label 4 ^: Y6 O5 F& Q9 z
   do ! k4 V& {9 I; H+ M
   if not dbg_Data.Exists(lbl) then exit do
* z% h$ g- Q$ g- S1 K  b; l   i = i + 1
+ Q5 Q) `( w) i/ R/ q   lbl = label &amp; "(" &amp; i &amp; ")" ! ?+ O( G* F7 _- u. \) P
   loop until i = i
! p# b0 _, i+ K  W  8 ]" L: l9 f6 J) B
   ValidLabel = lbl
4 X0 p5 \' m# ~( w) W: q$ gEnd Function $ ?% h& U5 s7 f. u, Y
  5 i! n8 K) W' Y
'*********************************************************** ! m* x9 C9 e+ J9 |6 A
'* PrintCookiesInfo 6 O9 N2 f: E7 Y2 O0 ^3 d: R
'***********************************************************
  ]9 z; d, i+ [Private Sub PrintCookiesInfo(byval DivSetNo) / _: C: z3 x! K1 v* ~% t; ]
   dim tbl, cookie, key, tmp 1 F. X; X8 ]# ^' J& b
   For Each cookie in Request.Cookies
% b# O$ e0 K7 d1 L   If Not Request.Cookies(cookie).HasKeys Then 4 N$ \3 ^% Y7 j6 {+ b  j
     tbl = AddRow(tbl, cookie, Request.Cookies(cookie))   
" w$ `$ P, O9 t8 p1 ~* o8 u9 j1 V   Else ; M9 w2 @7 j9 z3 O5 p9 c7 W
     For Each key in Request.Cookies(cookie)
8 T9 Q4 x8 ?- ?$ F     tbl = AddRow(tbl, cookie &amp; "(" &amp; key &amp; ")", Request.
/ B- ~2 y2 M! W+ r, S0 ECookies(cookie)(key))   
+ T5 n$ v, ~$ ^4 |4 t   Next
5 `$ g# C) o; \: ?7 U+ K9 z( Q   End If - T  H2 a* \: u1 a* o
   Next </P>% o& @* x* i+ Z/ A. A7 u4 I* w! Z
<>   tbl = MakeTable(tbl) % @8 w$ z% ~# f" F7 I- Q" r( _/ I
   if Request.Cookies.count &lt;= 0 then DivSetNo = 2
4 O* p" w) {. H6 w   tmp = replace(replace(replace(DivSets(DivSetNo),"#sectname#","COOKIES"),"#title#","COOKIES"),"#data#",tbl)
6 R0 h1 `( o. w+ X% y# u) W7 I! Z   Response.Write replace(tmp,"|", vbcrlf)
: j& ^6 h; q, K9 mend sub
; ]' Y' J, m1 N  
" k1 L+ \4 T+ ~'*********************************************************** - {. a: C5 o8 J; o
'* PrintSummaryInfo
" d7 O, c2 q( A'*********************************************************** 0 i5 e* K+ V# R
Private Sub PrintSummaryInfo(byval DivSetNo) + }8 ?; M; k4 r$ }- e9 g
   dim tmp, tbl
: K, y6 l2 m. {# |1 A: |5 t  a8 E& g   tbl = AddRow(tbl, "Time of Request",dbg_RequestTime) # q) q5 n% a% ?6 d, M. e
   tbl = AddRow(tbl, "Elapsed Time",DateDiff("s", dbg_RequestTime, dbg_FinishTime) &amp; " seconds")
6 j3 z9 \' Z7 }( A- j1 j* F   tbl = AddRow(tbl, "Request Type",Request.ServerVariables("REQUEST_METHOD"))
$ ~1 k8 C- R. e  w2 e   tbl = AddRow(tbl, "Status Code",Response.Status) 7 y/ i# m) v- b. K& M
   tbl = AddRow(tbl, "Script Engine",ScriptEngine &amp; " " &amp; ScriptEngineMajorVersion &amp; "." &amp; ScriptEngineMinorVersion &amp; "." &amp; ScriptEngineBuildVersion) % p0 W! S' ]4 M1 K" p' k
   tbl = MakeTable(tbl)
' ]2 V9 e  P- ?5 @& G   tmp = replace(replace(replace(DivSets(DivSetNo),"#sectname#","SUMMARY"),"#title#","SUMMARY INFO"),"#data#",tbl) # e$ d' h1 D4 s
   Response.Write replace(tmp,"|", vbcrlf) 7 I) u, h% \7 T9 R, s
End Sub </P>
! j7 n2 V( V2 Y1 ~* \) b<>'*********************************************************** ' B" ]% L% O1 s! k2 e2 Z
''@SDESCRIPTION: Adds the Database-connection object to the debug-instance. To display Database-information
5 [- e2 A9 e& N% H) Q''@PARAM:  - oSQLDB [object]: connection-object
! a: ?; i8 i2 G$ R'*********************************************************** " D- J  G9 Q% p& \
Public Sub GrabDatabaseInfo(byval oSQLDB) & f! {3 V2 V- b. B  C. \) D1 O/ l
   dbg_DB_Data = AddRow(dbg_DB_Data, "ADO Ver",oSQLDB.Version)
- R* b5 @- |3 Z, j. I   dbg_DB_Data = AddRow(dbg_DB_Data, "OLEDB Ver",oSQLDB.Properties("OLE DB Version")) . {9 r7 j1 `4 [+ W; i  v4 y
   dbg_DB_Data = AddRow</P>
作者: 韩冰    时间: 2004-11-21 11:44
(dbg_DB_Data, "DBMS",oSQLDB.Properties("DBMS Name") &amp; " Ver: " &amp; oSQLDB.Properties("DBMS Version")) ( u0 X9 t$ K6 L: d9 p) s, B& o$ j
   dbg_DB_Data = AddRow(dbg_DB_Data, "rovider",oSQLDB.Properties("rovider Name") &amp; " Ver: " &amp; oSQLDB.Properties("rovider Version"))
$ R3 V  X2 _9 J$ j' F% Q! P9 VEnd Sub <>'***********************************************************
% ?7 `2 w4 B7 ^/ `4 N0 u9 ^% V' F'* PrintDatabaseInfo ' q! Z; H# ]* `9 O- U$ b9 U
'*********************************************************** ; {+ L( m0 w5 k  S$ `: u  W
Private Sub PrintDatabaseInfo(byval DivSetNo) 2 B& u- P  x4 w& s, W
   dim tbl - [: {8 E7 v8 h$ y& P6 m5 t& j
   tbl = MakeTable(dbg_DB_Data)
' G; V" \) W* S1 L& a4 _1 [   tbl = replace(replace(replace(DivSets(DivSetNo),"#sectname#","DATABASE"),"#title#","DATABASE INFO"),"#data#",tbl) 9 D4 v* ]" u; A: G) p' T
   Response.Write replace(tbl,"|", vbcrlf) ; c! ~; Q$ Y- o2 U+ ^+ N
End Sub </P><>'*********************************************************** * R; }3 @% |2 `0 i2 ]; o8 z
'* PrintCollection , a0 p5 B& `+ G' P6 j" K6 q1 g
'*********************************************************** 5 }/ C5 ?3 l/ o* ^
Private Sub PrintCollection(Byval Name, ByVal Collection, ByVal DivSetNo, ByVal ExtraInfo) # O$ N0 _  p8 L5 A" t: P0 W0 b
   Dim vItem, tbl, Temp
3 ~, f2 P2 u2 }! g4 J. t8 o$ g   For Each vItem In Collection . H# K. G% f$ m& p3 Q0 p
     if isobject(Collection(vItem)) and Name &lt;&gt; "SERVER VARIABLES" and Name &lt;&gt; "QUERYSTRING" and Name &lt;&gt; "FORM" then 5 T/ \6 N* S' W3 i1 N- U, k3 i
       tbl = AddRow(tbl, vItem, "{object}") " k9 @! `6 }, e8 Z( j) q1 z2 x
     elseif isnull(Collection(vItem)) then
4 ^$ ~6 I( I; G& t9 L$ q) x       tbl = AddRow(tbl, vItem, "{null}") # U8 l% E2 h- ^, W! K- h# ~! S# d: v
     elseif isarray(Collection(vItem)) then , B# I$ [" d8 W( m  ?! G0 V
       tbl = AddRow(tbl, vItem, "{array}")
# H2 e$ |5 i4 Z  K3 Y3 u! S     else - y9 U' u8 c1 A! U4 p- R- g
       if dbg_AllVars then
, P0 V5 s3 t7 G* l% z       tbl = AddRow(tbl, "&lt;nobr&gt;" &amp; vItem &amp; "&lt;/nobr&gt;", server.HTMLEncode(Collection(vItem))) % f; k; I9 O% |  I
     elseif (Name = "SERVER VARIABLES" and vItem &lt;&gt; "ALL_HTTP" and vItem &lt;&gt; "ALL_RAW") or Name &lt;&gt; "SERVER VARIABLES" then 5 c/ b  A: J$ D# D" Y2 y$ Y
       if Collection(vItem) &lt;&gt; "" then
% Z9 h2 h, C: ?$ g: ]       tbl = AddRow(tbl, vItem, server.HTML
& C8 \4 v  ^* P: N- y- H  J7 I, sEncode(Collection(vItem))) ' &amp; " {" &amp; TypeName(Collection(vItem)) &amp; "}")
* k3 s% b1 T- S! k4 G* @2 P+ {       else . v/ G, |4 v& \( n! \8 l2 }
       tbl = AddRow(tbl, vItem, "...") 8 T- T( n/ S2 H. q5 `' O/ \( p
       end if 7 M+ A1 J* O2 U/ V4 |  n
     end if
  {2 E% F1 X5 B; _* Y# W$ b5 W+ ~   end if - v5 @! p" e5 l7 d6 Y# \, q/ t/ p0 q
   Next
! X- Z& M  G  V. b8 |" P7 u   if ExtraInfo &lt;&gt; "" then tbl = tbl &amp; "&lt;TR&gt;&lt;TD COLSPAN=2&gt;&lt;HR&gt;&lt;/TR&gt;" &amp; ExtraInfo
" u% S+ W5 n" N1 {# U   tbl = MakeTable(tbl)
  t6 F/ t1 G: A" U   if Collection.count &lt;= 0 then DivSetNo =2 / W  @1 n8 o' Y: s  a
     tbl = replace(replace(DivSets(DivSetNo),"#title#",Name),"#data#",tbl)
3 j) @: ]3 `. F     tbl = replace(tbl,"#sectname#",replace(Name," ",""))
6 m% j/ f" R% g. `     Response.Write replace(tbl,"|", vbcrlf)
: }3 H, S3 x/ I0 D* M6 `End Sub , A8 K' m3 l' s5 `+ Z9 B( {1 {
  2 N( |( {9 u! ^9 ?$ L
'***********************************************************
8 z& C$ {7 o4 X$ `'* AddRow 9 u0 l+ u! {7 d+ R7 U. u
'***********************************************************
: K/ R4 X# r0 H9 h9 jPrivate Function AddRow(byval t, byval var, byval val) ) L7 j( }( W- d# S3 B! U
   t = t &amp; "|&lt;TR valign=top&gt;|&lt;TD&gt;|" &amp; var &amp; "|&lt;TD&gt;= " &amp; val &amp; "|&lt;/TR&gt;"
, i2 q3 j" C0 R5 S   AddRow = t
0 y$ h) @- n9 H& d) p3 T! g) `. @  YEnd Function </P><>'***********************************************************
. {" M* `5 p# |& |' ^6 |1 l& y'* MakeTable
$ L: U2 Z' _7 q" h'***********************************************************
. y' e% _$ F9 a$ Y9 KPrivate Function MakeTable(byval tdata) , q: |% j% H- g, h0 m, ^1 O
   tdata = "|&lt;table border=0 style=""font-size:10pt;font-weight:normal;""&gt;" + tdata + "&lt;/Table&gt;|" : Q/ k4 S4 t0 T  V- I0 N
   MakeTable = tdata
# b$ c# E( v' m. D' Z- X4 Q0 L- CEnd Function </P><>'***********************************************************
  E' X3 f0 {! F  O''@SDESCRIPTION: Draws the Debug-panel ; v' F* R) V( S! j7 W8 T. G
'*********************************************************** 6 J4 }8 V7 k3 j5 G( T- F3 Q
Public Sub draw() & K! U! W  p  R4 W% z1 z
   If dbg_Enabled Then
! j# f7 d' f# O& v2 d7 y% N# v     dbg_FinishTime = Now()
2 W- R3 ?6 A1 b8 b  / t% u% R# M3 `- z5 \
   Dim DivSet, x - a6 R* f: k& t. G+ z0 K% e
   DivSet = split(dbg_Show_default,",")
4 }8 @* M0 g" z/ p& p9 m3 B" U0 f     dbg_Show = split(dbg_Show,",") # T4 B9 ]" W: m! R- @, d
  , y8 P. h! i' v; h+ w
   For x = 0 to ubound(dbg_Show) * Z- y% k6 b" t0 G
     divSet(x) = dbg_Show(x)
* X( i, }" N! Q   Next
* i3 Y0 |! |& j- n  ( Z6 a, a( `  G* r
   Response.Write "&lt;BR&gt;&lt;Table width=100% cellspacing=0 border=0 style=""font-family:arial;font-size:9pt;font-weight:normal;""&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV style=""background:#005A9E;color:white;padding:4;font-size:12pt;font-weight:bold;""&gt;Debugging-console:&lt;/DIV&gt;" / K0 r- g- x0 X" \+ |0 x; M: h' z  z" H
   Call PrintSummaryInfo(divSet(0)) . ]& D2 s7 J0 ^+ k
     Call PrintCollection("VARIABLES", dbg_Data,divSet(1),"") ; J4 ^8 h; ]1 y1 x$ V; l
    Call PrintCollection("QUERYSTRING", Request.QueryString(), divSet(2),"") 5 X$ F3 x. s. c" o4 a3 c' X1 N; g
    Call PrintCollection("FORM", Request.Form(),divSet(3),"")
2 z+ K! z- a) e) L7 P; C    Call PrintCookiesInfo(divSet(4))
; {7 R$ B3 ~2 v0 o    Call PrintCollection("SESSION", Session.Contents(),divSet(5),AddRow(AddRow(AddRow("","Locale ID",Session.LCID &amp; " (&amp;H" &amp; Hex(Session.LCID) &amp; ")"),"Code Page",Session.CodePage),"Session ID",Session.SessionID))
# o  i: O; ]0 _4 E    Call PrintCollection("APPLICATION", Application.Contents(),divSet(6),"") / u- G: }2 e; r
    Call PrintCollection("SERVER VARIABLES", Request.ServerVariables(),divSet(7),AddRow("","Timeout",Server.ScriptTimeout)) 6 b% _+ S$ Z% p& S  J
    Call PrintDatabaseInfo(divSet(8))
% w9 L0 Z( [; X1 |    Call PrintCollection("SESSION STATIC OBJECTS", Session.StaticObjects(),divSet(9),"") ( `1 Z% m5 @% e: |  p
    Call PrintCollection("APPLICATION STATIC OBJECTS", Application.StaticObjects(),divSet(10),"")
4 b/ a5 \& e9 c: s    Response.Write "&lt;/Table&gt;" # M5 P# W; f$ O
   End If
9 F1 b! g2 {, h. |2 EEnd Sub </P><>'Destructor 1 K- c6 S( O/ y. Q0 P7 [. Y7 U
Private Sub Class_Terminate()
# m: C( Q2 ~1 w2 N# u   Set dbg_Data = Nothing
0 B- t  m+ [- L2 g. yEnd Sub </P><>End Class </P><>%&gt; </P><>类的说明: </P><>
, Z, W5 H5 W# I# d9 S' r# R. kCLASS debuggingConsole 5 W' n0 o  C+ ]. S
Version: 1.2 </P><>-------------------------------------------------------------------------------- </P><>ublic Properties </P><>roperty Let Enabled(bNewValue)===[bool] Sets "enabled" to true or false % O. @1 T) o+ c8 f; W: r0 H) f
&amp;n
1 A, G: s9 f# h7 h3 ~! Nbsp; . h+ L- M( l" D9 ^' K
Property Get Enabled===[bool] Gets the "enabled" value
4 o7 ]; p: Y# }  
# ^# R! d( H+ a4 SProperty Let Show(bNewValue)===[string] Sets the debugging panel. Where each digit in the string represents a debug information pane in order (11 of them). 1=open, 0=closed
! J: G- T) f, a! _7 o0 Y2 X& B! X6 N  
! |' i! X# |3 E+ R3 w2 E/ |$ FProperty Get Show===[string] Gets the debugging panel. 5 N4 w$ q8 c- G  u( G$ ]7 z
  , E% L4 z/ N$ v1 x' s& ^! D8 m
Property Let AllVars(bNewValue)===[bool] Sets wheather all variables will be displayed or not. true/false </P><>roperty Get AllVars===[bool] Gets if all variables will be displayed.  </P><>--------------------------------------------------------------------------------
6 H5 }6 a: t7 V0 o0 BPublic Methods </P><>public sub===Print (label, output) ! ]0 N- w$ @1 \/ v( a0 v! H$ j! ^/ U0 _
   Adds a variable to the debug-informations.  </P><>public sub===GrabDatabaseInfo (byval oSQLDB)
1 `. o5 Y! Z" M/ w# m# n) C, p   Adds the Database-connection object to the debug-instance. To display Database-information  </P><>public sub===draw ()
" P' i* w. B9 N2 x& x. |( K6 b   Draws the Debug-panel  </P><>-------------------------------------------------------------------------------- 5 M! |9 }0 J* N  B/ a
Methods Detail 7 C5 J3 D9 P6 S& J0 A- t$ O# u
  
8 ?) g& x  N: B+ epublic sub===Print (label, output) ' C* j* O5 a( o: i$ s8 ?
Parameters:  
& K; Y) a! F+ t% u   - label [string]: Description of the variable 5 G) w$ e4 P, C
   - output [variable]: The variable itself - \/ W: E) _. E% l7 _( L6 t
  ' j% x9 ^" Y% @! N& R: M/ {! `" ]
public sub===GrabDatabaseInfo (byval oSQLDB) * X# k2 R- ~. d" F7 `( g" T
Parameters:  ; l  M" C9 `4 m' ?
   - oSQLDB [object]: connection-object</P>




欢迎光临 数学建模社区-数学中国 (http://www.madio.net/) Powered by Discuz! X2.5