数学建模社区-数学中国

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

作者: 韩冰    时间: 2004-11-21 11:43
标题: ASP中令人震撼的Debug类(VBScript)
<>不知道用ASP写代码的朋友是不是和我有一样的感受,ASP中最头疼的就是调试程序的时候不方便,我想可能很多朋友都会用这样的方法“response.write ”,然后输出相关的语句来看看是否正确。前几天写了一个千行的页面,里面大概有七八个SUB/FUNCTION,调试的时候用了有三十几个response.write ,天,调试完后把这三十个一个个删除,累! </P>
+ a  i* ?) k9 q; V<>今天看到一个ASP中的Debug类(VBS),试用了一下,绝!
& i/ F; L' a* g+ \9 c使用方法很简单: 6 _3 ^! p7 L0 r
test.asp </P>$ p+ A2 s  i, P7 C
<>&lt;!--#INCLUDE FILE="debuggingConsole.asp"--&gt; + q% {6 n  N# l, g  X
&lt;%
/ N# v; N4 G" Koutput="XXXX" # J+ V3 {' G: \9 M6 w. f
Set debugstr = New debuggingConsole   \4 M2 i1 w( S: n, T5 X5 B
debugstr.Enabled = true
  k* T% E0 u: `   debugstr.Print "参数output的值", output
" g  S% e# b" P* }. M9 m; o   '…… 4 H- C; G7 ?" I, e% t, E7 L
   debugstr.draw
7 @  x, ^+ e4 d, w/ JSet debugstr = Nothing 8 r6 u- c% w; _" r0 e
%&gt; </P>
5 |- a: B* i) }2 A1 P5 `<>=================================================== </P>
/ h( B2 n) a2 Y# X<>debuggingConsole.asp </P>
; b2 {- N( X1 c1 L/ J<>&lt;% ; K' _5 {4 t/ E7 u2 Z
Class debuggingConsole </P>1 X* s1 j1 s) ~6 P4 ^1 v
<>   private dbg_Enabled
( Q2 F" B/ \7 J0 j   private dbg_Show
/ i; o% l4 _5 [: `& \3 m0 G/ H  D   private dbg_RequestTime
: M0 |2 \  _7 s6 s6 @  i7 p3 m& Q   private dbg_FinishTime
$ z& |- S  i' q" @8 h- ~8 {   private dbg_Data
! i& G7 x8 \" K* K. `8 a( B0 U" {   private dbg_DB_Data " k; u3 M9 K; c( s' m; x
   private dbg_AllVars 6 ^! j% m+ V( b6 h% w" p
   private dbg_Show_default
9 [2 `! t/ V3 ?   private DivSets(2) + ?$ n0 j9 q! X+ w
   * P7 r" ~/ \, C2 l. x0 v$ c- \3 n$ U
'Construktor =&gt; set the default values
! p: N' l! U* N% CPrivate Sub Class_Initialize()   E. _6 d1 A0 y/ {  I, s- Q  ~
   dbg_RequestTime = Now()   A/ l7 I9 g- U$ X9 a
   dbg_AllVars = false
. ^4 e0 E/ e) V* w7 G6 T4 t$ x/ ?   Set dbg_Data = Server.CreateObject("Scripting.Dictionary") </P>
$ V# Z. x) E5 V+ g1 I8 i<>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>
# m& u4 ?: ^: ~. \$ M0 g<>   DivSets(1) = "&lt;TR&gt;&lt;TD&gt;) d, Q) ^2 [- t/ u$ m5 E
&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>" q8 z8 ^" N0 e& L1 M; s$ ^
<>   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>
' B( n9 |2 u, I1 A$ K. s/ ?" {<>   dbg_Show_default = "0,0,0,0,0,0,0,0,0,0,0"
. L4 {: c: Y1 S; t, `End Sub </P>
9 ?. w- @! v, K: o+ X% S<>ublic Property Let Enabled(bNewValue) ''[bool] Sets "enabled" to true or false
( u# C% [& ]% Y   dbg_Enabled = bNewValue
1 L8 _& @, h, q- Q4 @" W8 FEnd Property </P>
& b2 o7 E% h) z6 j7 ]+ M<>ublic Property Get Enabled ''[bool] Gets the "enabled" value
% T2 y8 }' }! C* q% r8 H2 l8 r3 B   Enabled = dbg_Enabled
  Q, h# H* d/ FEnd Property </P>. [) Z1 d5 H" e- ~
<>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 8 y7 U) i2 O1 B  c/ a4 W; u5 o
   dbg_Show = bNewValue
, x$ J0 Z4 Y% W% jEnd Property </P>" k1 e1 w7 H$ P0 d
<>ublic Property Get Show ''[string] Gets the debugging panel.
6 D5 p; U3 j/ C- s6 T" a7 v3 w% O   Show = dbg_Show 1 W, h; I; q3 C8 F$ Q0 E3 I6 o
End Property </P>
; O" |" i# u5 S  {* }<>ublic Property Let AllVars(bNewValue) ''[bool] Sets wheather all variables will be displayed or not. true/false & s/ e8 f% A& `/ `% w
   dbg_AllVars = bNewValue 4 c# [% [; K! E* b
End Property </P>
+ o( e* d6 p. l% W: q' b. b<>ublic Property Get AllVars ''[bool] Gets if all variables will be displayed.
' T/ m: [1 J9 G   AllVars = dbg_AllVars 9 t: E) V' ~* F) \4 m
End Property </P>* @( ~7 p' H% V' q- m' o4 x
<>'***********************************************************
8 ~7 R  ~, E; T- a' A( b) d1 x' C''@SDESCRIPTION: Adds a variable to the debug-informations. - K2 \! n0 j* k9 ]! E" Q) T0 v
''@PARAM:  - label [string]: Description of the variable 6 ]& w4 L8 \  x0 n6 z
''@PARAM:  - output [variable]: The variable itself
- V/ V% y+ \" V8 p- ?& @! T; e'*********************************************************** 1 J9 C) b6 D& b* ]% r; }1 g- C
Public Sub Print(label, output)
' F. A+ Z# Q( w4 \  N- F   If dbg_Enabled Then
8 h: a  d( E+ N2 l' y/ d     if err.number &gt; 0 then
6 ]7 G# {9 p* p0 I( u+ e       call dbg_Data.Add(ValidLabel(label), "!!! Error: " &amp; err.number &amp; " " &amp; err.Description) , Z$ x6 B- |- h/ A! F3 k
       err.Clear / a& [# t* y: ^$ w& [& K( R3 ]
     else 6 [- n  y$ N4 P8 A" D! F, d2 l
       uniqueID = ValidLabel(label) 4 H5 c7 {  z# g$ Q
       response.write uniqueID
7 A6 K- w% T) z9 l/ h/ H7 O* T* U       call dbg_Data.Add(uniqueID, output) 4 k; r; B. m5 ^+ J* k# Y' P  P& Y$ n$ W) d
     end if   i  u; A+ d# a) I+ M' U- K- ]& g, e4 M
   End If
- f2 V  j/ f. B/ h5 x) P! vEnd Sub
2 v( k8 f, D3 Y* T8 W. O  
( J0 x7 G, }+ Y! o( W1 Q# m'*********************************************************** 9 R0 R: k- D# P/ _) @9 }0 S
'* ValidLabel
' Y- h, Z! G' l3 V) m3 \. Y'***********************************************************
6 m/ P3 E  b' e6 H6 B5 F) [) WPrivate Function ValidLabel(byval label)
6 r# Q. L& b+ f. K# a6 J   dim i, lbl
: a0 x9 U$ q/ `4 Z1 X: `5 b3 w# g  g   i = 0
: f" q9 w4 K. l0 D0 y   lbl = label ' M7 S7 U0 N' ~5 ^9 U
   do
/ D9 l4 Z! t  f1 ^2 ?1 ~" ~   if not dbg_Data.Exists(lbl) then exit do 2 F/ u" @$ F5 C
   i = i + 1
, F3 ]' q; y! @+ N. H  M! V" w   lbl = label &amp; "(" &amp; i &amp; ")" : O; S( [1 r: n2 A& ^4 J
   loop until i = i
$ \9 N0 q- ]2 g4 f7 e& A% u) W  ( v. A: ]8 V# K  N$ _
   ValidLabel = lbl - b3 v  j' E; _1 S7 T  {) \8 B& f
End Function
# Z/ U, Q' K$ v* o6 X+ \. p( O  * K1 e3 m. \  l9 A
'***********************************************************
4 Y% N& Y/ `! w0 @) i% T9 p'* PrintCookiesInfo
2 _$ C# l" N3 w8 w'*********************************************************** ' X) s6 h  n- M0 Z. l5 R4 D$ l6 s
Private Sub PrintCookiesInfo(byval DivSetNo)   e7 g  \! [! e3 F. ?8 S
   dim tbl, cookie, key, tmp 3 E, m$ U; h4 b1 G! Z
   For Each cookie in Request.Cookies
, i% G# C! I4 s! z& B5 g   If Not Request.Cookies(cookie).HasKeys Then
, a; G! x0 T  o. t  k5 r, T% z     tbl = AddRow(tbl, cookie, Request.Cookies(cookie))   ; ?, G4 k* E+ f& s
   Else 9 c2 e4 s: i3 o6 g+ w( m- F
     For Each key in Request.Cookies(cookie)
2 T& S# U6 Y7 R9 g     tbl = AddRow(tbl, cookie &amp; "(" &amp; key &amp; ")", Request.
  z5 D& O. U  W" }0 n$ p. ]Cookies(cookie)(key))   " Z. D( l$ y* Y+ X% y  S' t
   Next
+ [4 U3 D# L$ C) x   End If ( N, |: R5 ?  |
   Next </P>
+ a" |# m0 G# w( N<>   tbl = MakeTable(tbl)
" K" I: Y- k/ H* v" ]   if Request.Cookies.count &lt;= 0 then DivSetNo = 2
0 J/ O: m" Z9 g) r9 i% B. R- Y   tmp = replace(replace(replace(DivSets(DivSetNo),"#sectname#","COOKIES"),"#title#","COOKIES"),"#data#",tbl) ) x" K1 {6 S  o8 z& w  l5 W: ?! @
   Response.Write replace(tmp,"|", vbcrlf) 5 q7 ?) p% h9 ?" N
end sub
2 q7 a3 D* H4 g* c  & `& x! M# I. {' \4 `
'*********************************************************** ; Z- a: ^7 V% T
'* PrintSummaryInfo % O4 _& Z7 J7 T! ^
'*********************************************************** ( p) E0 K. R$ A# V) ~9 i  j! ]
Private Sub PrintSummaryInfo(byval DivSetNo)
: h+ w( c4 j, @+ [* ?( u$ e. S   dim tmp, tbl
# C, J# c' m5 x  ^9 p6 |8 @2 z   tbl = AddRow(tbl, "Time of Request",dbg_RequestTime)
$ S" D% H* g& c5 y5 w5 Y% S/ r   tbl = AddRow(tbl, "Elapsed Time",DateDiff("s", dbg_RequestTime, dbg_FinishTime) &amp; " seconds") 4 y: g, I$ U' [
   tbl = AddRow(tbl, "Request Type",Request.ServerVariables("REQUEST_METHOD"))
  p/ C, O( m4 r7 j   tbl = AddRow(tbl, "Status Code",Response.Status) 3 x7 h1 h# @6 [
   tbl = AddRow(tbl, "Script Engine",ScriptEngine &amp; " " &amp; ScriptEngineMajorVersion &amp; "." &amp; ScriptEngineMinorVersion &amp; "." &amp; ScriptEngineBuildVersion)
) `' ]( ^- Y! K) h' z   tbl = MakeTable(tbl)
; y0 M; z/ O* K, Z/ b" }   tmp = replace(replace(replace(DivSets(DivSetNo),"#sectname#","SUMMARY"),"#title#","SUMMARY INFO"),"#data#",tbl) : h! h/ O/ }9 y  r  k2 J
   Response.Write replace(tmp,"|", vbcrlf) . i0 J* H2 i% `" V$ Y# s5 F8 y( c
End Sub </P>5 v) H/ G. @( F3 d) s) S
<>'*********************************************************** 6 F3 L0 v+ a" z$ j1 C3 Y
''@SDESCRIPTION: Adds the Database-connection object to the debug-instance. To display Database-information
' |+ t0 z$ B5 X/ s0 x# C, a''@PARAM:  - oSQLDB [object]: connection-object 3 `# a1 t( k; I& x; K
'*********************************************************** ! Z: `3 y, R) J0 q
Public Sub GrabDatabaseInfo(byval oSQLDB)
9 L: @  K7 M5 q0 Q5 G0 P   dbg_DB_Data = AddRow(dbg_DB_Data, "ADO Ver",oSQLDB.Version) 9 n) U4 D. g' |; V/ I
   dbg_DB_Data = AddRow(dbg_DB_Data, "OLEDB Ver",oSQLDB.Properties("OLE DB Version")) / L% Q) R- H* e: k; x$ 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")) ; J9 y- `" C4 V6 L7 _- _0 ^: w
   dbg_DB_Data = AddRow(dbg_DB_Data, "rovider",oSQLDB.Properties("rovider Name") &amp; " Ver: " &amp; oSQLDB.Properties("rovider Version"))
6 h; K( q1 D2 f# KEnd Sub <>'***********************************************************
  j& k/ P4 s- z9 w* T1 i% L- i" ]8 i7 v'* PrintDatabaseInfo
  l# D( A- Z. C; V. \1 {, U  R9 W'*********************************************************** : ]9 `" Q* w1 w" q$ h
Private Sub PrintDatabaseInfo(byval DivSetNo)
8 k5 A5 g- g3 _* X4 K) x   dim tbl - q  `3 g1 q" }! K2 t0 I3 B0 M0 b5 W5 K
   tbl = MakeTable(dbg_DB_Data)
$ i5 R3 C2 w6 E/ k0 n   tbl = replace(replace(replace(DivSets(DivSetNo),"#sectname#","DATABASE"),"#title#","DATABASE INFO"),"#data#",tbl)
0 h' X$ @9 m1 X5 R3 N   Response.Write replace(tbl,"|", vbcrlf) ' d2 }" F$ d# V- w
End Sub </P><>'*********************************************************** 8 Y3 d7 Z" ?) ?& j$ r7 j
'* PrintCollection
7 w6 @" t) G0 K6 F6 Q0 k9 {'***********************************************************
4 `6 {0 g7 ~: i& }Private Sub PrintCollection(Byval Name, ByVal Collection, ByVal DivSetNo, ByVal ExtraInfo)
$ S8 E3 k6 `6 v9 ^( A5 o   Dim vItem, tbl, Temp 9 \/ L- |( t* F* ?9 J# A. y
   For Each vItem In Collection
! P( l& |  U3 D- c" L     if isobject(Collection(vItem)) and Name &lt;&gt; "SERVER VARIABLES" and Name &lt;&gt; "QUERYSTRING" and Name &lt;&gt; "FORM" then
4 `2 H! v3 {, \- {       tbl = AddRow(tbl, vItem, "{object}") 8 ]1 _9 F5 y8 F2 j
     elseif isnull(Collection(vItem)) then $ b0 B- n+ M0 ]
       tbl = AddRow(tbl, vItem, "{null}")
4 J3 |/ _: W' @: B/ x1 x5 m     elseif isarray(Collection(vItem)) then ! p5 [) N7 r! u6 A" R
       tbl = AddRow(tbl, vItem, "{array}") , j& ]3 l! p+ o
     else ; D2 S; Z5 \( y: Y
       if dbg_AllVars then
) O: Q% G- ]+ m- O6 ^) D       tbl = AddRow(tbl, "&lt;nobr&gt;" &amp; vItem &amp; "&lt;/nobr&gt;", server.HTMLEncode(Collection(vItem))) 0 l& a- v1 f6 C1 r9 k) E0 t
     elseif (Name = "SERVER VARIABLES" and vItem &lt;&gt; "ALL_HTTP" and vItem &lt;&gt; "ALL_RAW") or Name &lt;&gt; "SERVER VARIABLES" then
% z$ [. d+ O* H' d  h, E       if Collection(vItem) &lt;&gt; "" then * t) [+ K7 n$ R7 [$ j
       tbl = AddRow(tbl, vItem, server.HTML
+ ]$ j& u7 O. v: ]- }- Q2 A3 v$ {Encode(Collection(vItem))) ' &amp; " {" &amp; TypeName(Collection(vItem)) &amp; "}")
( e2 J: \) j! \       else
! @; D: s2 P9 y0 u0 }+ R       tbl = AddRow(tbl, vItem, "...") ! [* @4 I- w4 p
       end if
2 f! T+ ]& p0 u4 m* }     end if
6 B7 }* q5 |+ E   end if   k. l9 Z' x2 @1 S
   Next
2 H3 y: v7 @& v) V! T4 J* e0 v   if ExtraInfo &lt;&gt; "" then tbl = tbl &amp; "&lt;TR&gt;&lt;TD COLSPAN=2&gt;&lt;HR&gt;&lt;/TR&gt;" &amp; ExtraInfo 8 w: g; y. L, y1 G
   tbl = MakeTable(tbl) * f5 f8 L4 D2 ]
   if Collection.count &lt;= 0 then DivSetNo =2 ! t% b7 r# ^3 r
     tbl = replace(replace(DivSets(DivSetNo),"#title#",Name),"#data#",tbl)
+ |8 g$ C. Y; U0 ^. Y: s! _( Z     tbl = replace(tbl,"#sectname#",replace(Name," ","")) . D3 x6 N) [$ }
     Response.Write replace(tbl,"|", vbcrlf)
" ~, l9 n) v. u, e5 W4 k' yEnd Sub
& Y% @+ T) _& N; B' |; n  " v  S7 I0 ~  g+ C
'*********************************************************** ! c( g' ^# |0 J" V
'* AddRow
9 K6 f+ ?; Y, |! }'***********************************************************
* P( |% n+ K8 i+ z# vPrivate Function AddRow(byval t, byval var, byval val) : M( Y! @* i2 o* `
   t = t &amp; "|&lt;TR valign=top&gt;|&lt;TD&gt;|" &amp; var &amp; "|&lt;TD&gt;= " &amp; val &amp; "|&lt;/TR&gt;"
, |7 W8 U+ b; J+ e: k: P$ X1 i   AddRow = t 5 R) v/ U$ j$ Y7 C$ @" I9 Y, ~# e
End Function </P><>'***********************************************************
  d3 E) ~, m9 L- K1 C'* MakeTable
. ]7 h" v& U$ {4 P5 H'*********************************************************** ! e, L0 |1 A# A$ r: J; p1 \- _
Private Function MakeTable(byval tdata)
9 ^8 b1 H, Q5 S1 w   tdata = "|&lt;table border=0 style=""font-size:10pt;font-weight:normal;""&gt;" + tdata + "&lt;/Table&gt;|"
, X$ l# f: G: i6 s0 d. @6 h   MakeTable = tdata
3 `( x8 e: s" T* Q6 h4 vEnd Function </P><>'***********************************************************
9 W- A$ V/ l. n. Z''@SDESCRIPTION: Draws the Debug-panel # }) I/ A6 \% h- z6 G' v0 y
'***********************************************************
8 A8 m: f; D! r- G8 vPublic Sub draw() 5 e6 V5 R( L9 j) c$ T$ s4 l. ]
   If dbg_Enabled Then
6 B0 [' V  [! g! c% T; R0 x7 [     dbg_FinishTime = Now() ' b7 v: @/ |( d4 C* i5 R# {
  # u; Q( ]* [5 t( c0 j7 `! r; z
   Dim DivSet, x ) Q- U  x5 n% ?* T7 F* y, ~( I
   DivSet = split(dbg_Show_default,",")
* d6 b# a% }6 r( t6 a     dbg_Show = split(dbg_Show,",") - `# g% V, A4 `! G
  
# \1 ^6 Q& j2 _) _+ P7 W; m) D9 U   For x = 0 to ubound(dbg_Show)
3 O: \' k* X1 u  e/ L     divSet(x) = dbg_Show(x) 0 J" M! o4 ]9 X% i! }" H! N
   Next
1 I/ b; R1 x5 \% Q  X! _  
' C( F! U$ ?0 x9 c' l9 ^; q& z  c# l) N   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;"
! r5 i5 W) [3 Y4 w* v   Call PrintSummaryInfo(divSet(0))
/ u7 h) H/ n* ]2 a  E; d8 y  N     Call PrintCollection("VARIABLES", dbg_Data,divSet(1),"")
5 `# m1 l6 y1 M5 b7 j; O  o    Call PrintCollection("QUERYSTRING", Request.QueryString(), divSet(2),"")
) N+ D9 [1 E. ^% b  ^    Call PrintCollection("FORM", Request.Form(),divSet(3),"") 6 j6 ?: \; A% b% L) f0 C6 t# m/ Z
    Call PrintCookiesInfo(divSet(4))
: J" g4 I/ ?# K( I    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))
' \0 K" p7 O: B8 y( [/ g( B6 Z    Call PrintCollection("APPLICATION", Application.Contents(),divSet(6),"") & U  T+ O! K/ k
    Call PrintCollection("SERVER VARIABLES", Request.ServerVariables(),divSet(7),AddRow("","Timeout",Server.ScriptTimeout))
/ z+ [! H; b# e2 v8 l. I0 S    Call PrintDatabaseInfo(divSet(8)) * y1 ]$ i3 E' c) B7 [, [
    Call PrintCollection("SESSION STATIC OBJECTS", Session.StaticObjects(),divSet(9),"")
' W# m% H3 E: u$ D) |! O    Call PrintCollection("APPLICATION STATIC OBJECTS", Application.StaticObjects(),divSet(10),"")
+ [$ c, Y: K0 F/ D    Response.Write "&lt;/Table&gt;" : @, v! O! C8 |$ n, n5 g+ R" }
   End If : {3 `! r' F$ d3 ]
End Sub </P><>'Destructor
+ b% z" f" G( O7 `) l  Y; O: Q0 iPrivate Sub Class_Terminate()
  v; x, d& A; E( M/ g$ e0 o   Set dbg_Data = Nothing
) ?# J. W# T: F) Q1 W3 x0 \End Sub </P><>End Class </P><>%&gt; </P><>类的说明: </P><>
! \9 a- @$ G1 k% }5 a# y# o. c6 |CLASS debuggingConsole 0 S' a+ k& u, ~' `
Version: 1.2 </P><>-------------------------------------------------------------------------------- </P><>ublic Properties </P><>roperty Let Enabled(bNewValue)===[bool] Sets "enabled" to true or false 8 n9 r: {: n& @3 a2 x, C
&amp;n
- |% p3 U8 ?( O) w3 K4 f6 T, K8 zbsp;
0 w. Q/ p- R# r$ NProperty Get Enabled===[bool] Gets the "enabled" value
4 y0 Q6 ]1 F% D  
2 s! a  `% P1 Y# Q2 O! H- fProperty 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 1 P+ H$ S0 C4 a* Y! X
  * L1 M4 e- H# ]
Property Get Show===[string] Gets the debugging panel.
' C% d* ^6 s/ i2 n& D2 h# n  5 B& P4 f" q% V
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><>-------------------------------------------------------------------------------- 0 `$ o& p% G) M  x% w5 H5 b. E
Public Methods </P><>public sub===Print (label, output)
; T, x' ~4 m. p: _: C   Adds a variable to the debug-informations.  </P><>public sub===GrabDatabaseInfo (byval oSQLDB)
$ \: z0 C' z3 W5 v5 R   Adds the Database-connection object to the debug-instance. To display Database-information  </P><>public sub===draw () # _3 K: i, M7 ?. ?8 C* e0 r
   Draws the Debug-panel  </P><>--------------------------------------------------------------------------------
5 ]" Y3 K" R/ J+ h6 aMethods Detail
- L& Y' q& t8 I  
/ K" j7 ^/ j6 O4 A) ^public sub===Print (label, output)
% K! G4 i. K& s" j: aParameters:  7 I# k: b8 ]' W+ e
   - label [string]: Description of the variable 0 ~0 _! s, q, m- I
   - output [variable]: The variable itself 1 s) P' J) ?. u8 _8 }5 q1 W
  2 e4 ^. z7 K8 h* X( R- n$ {
public sub===GrabDatabaseInfo (byval oSQLDB) " i0 `5 D/ K8 S5 y/ i5 I6 F" ]
Parameters:  ' _. F; {( C1 b3 N  r' [  I
   - oSQLDB [object]: connection-object</P>




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