数学建模社区-数学中国

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

作者: 韩冰    时间: 2004-11-21 11:43
标题: ASP中令人震撼的Debug类(VBScript)
<>不知道用ASP写代码的朋友是不是和我有一样的感受,ASP中最头疼的就是调试程序的时候不方便,我想可能很多朋友都会用这样的方法“response.write ”,然后输出相关的语句来看看是否正确。前几天写了一个千行的页面,里面大概有七八个SUB/FUNCTION,调试的时候用了有三十几个response.write ,天,调试完后把这三十个一个个删除,累! </P>: l2 G  S/ Q$ m/ d5 f! R$ G6 l
<>今天看到一个ASP中的Debug类(VBS),试用了一下,绝!
8 ?) \& D' ^- D% r- H' `使用方法很简单:
4 {$ d( U2 x) v7 ?' ztest.asp </P>8 Z" [5 l7 s5 V5 q" t, @
<>&lt;!--#INCLUDE FILE="debuggingConsole.asp"--&gt; * W: v8 w: C) ~/ ?% t# R: n
&lt;%   S6 b3 k4 w5 m$ J
output="XXXX"
' x* c: w4 ^& @8 O0 b  hSet debugstr = New debuggingConsole 3 I; B. D! D5 o" l; A$ _# s# F
debugstr.Enabled = true
( o0 @" U* Z4 i, ^) M! M' I   debugstr.Print "参数output的值", output
, h1 E+ ]2 `- l) h, a. s8 i' L1 |   '……   i6 W6 V3 O) k( W% O  |" R
   debugstr.draw
; s7 b% G+ f* R: o) K( T0 x: DSet debugstr = Nothing 0 F2 O1 X4 q: n  r
%&gt; </P>6 a, y9 R$ L2 g  v' b5 ]
<>=================================================== </P>
. ]7 e+ E& s7 I<>debuggingConsole.asp </P>+ y& q" ^* S4 K9 o( ~, y; d) [
<>&lt;%
5 A) M' n, J& H; d% T2 z. H6 CClass debuggingConsole </P>
; R0 i4 o! n$ ]# h2 h<>   private dbg_Enabled ' f9 N! \; F# }& d, c+ z
   private dbg_Show
* m7 W; I) h0 p   private dbg_RequestTime
, Q0 s. ?7 \. L. h1 a4 ^  N   private dbg_FinishTime $ m* I7 w& E9 |/ L
   private dbg_Data
" o; Z# x( L* ]3 q( C# \- d; L0 z, R   private dbg_DB_Data
' E+ v* r% x8 e8 R0 Y8 |6 @; Z   private dbg_AllVars - N* a/ F6 |, S! H
   private dbg_Show_default 0 K7 ]; m$ n, k, a4 {" a" W8 v
   private DivSets(2)
1 Y! ]; S: y! |3 [. Z1 E! w   
- Z, \7 `" G- i" `) O$ K'Construktor =&gt; set the default values 8 J. L6 J2 I$ n3 J& w5 \$ n
Private Sub Class_Initialize() & \3 f4 i9 t2 f
   dbg_RequestTime = Now() 1 K7 I, o6 Z) q6 C$ w( n9 d
   dbg_AllVars = false ) i7 `  h, `$ w  H' T- [: r, L
   Set dbg_Data = Server.CreateObject("Scripting.Dictionary") </P>
% R# n1 O# K' \# D% o8 c; ^<>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>
+ F3 E, f5 U( n0 f4 ^<>   DivSets(1) = "&lt;TR&gt;&lt;TD&gt;
3 K0 K4 k) D' g' A&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>1 \. s) o( l& ^( E
<>   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>- u1 Y! G" t3 T+ E; ^: m8 I
<>   dbg_Show_default = "0,0,0,0,0,0,0,0,0,0,0" ! @8 h+ O& a7 r/ \, D. e9 ~- u
End Sub </P>
; w  ?' _2 C# f# c5 c; M4 V% Q<>ublic Property Let Enabled(bNewValue) ''[bool] Sets "enabled" to true or false
7 @, }& H+ T7 V$ I/ I! p   dbg_Enabled = bNewValue ) |6 K9 a2 |' Q" \# g% T) l8 h
End Property </P>
) T' I2 }8 g; w( I<>ublic Property Get Enabled ''[bool] Gets the "enabled" value
" d% I9 i6 ]- W: E, x8 X) T. j" i   Enabled = dbg_Enabled 9 |# B9 q) X/ @
End Property </P>; s4 q2 o5 a5 `" t9 S+ l
<>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 ; P' X3 x. \( h
   dbg_Show = bNewValue
$ _/ \" O% o& n* O6 ]# J: EEnd Property </P>5 F: P( p, k2 V& V. [- o) \, h
<>ublic Property Get Show ''[string] Gets the debugging panel.
2 B# F4 A$ G  W4 i/ V% ?   Show = dbg_Show
  v( t: @. a1 x+ pEnd Property </P>, n) b$ N6 g* z# P
<>ublic Property Let AllVars(bNewValue) ''[bool] Sets wheather all variables will be displayed or not. true/false * T1 c8 }$ b: ]: c9 @! i. U
   dbg_AllVars = bNewValue 4 r5 E1 |/ Y1 ~3 ]
End Property </P>  @- m0 C: E- s1 I' `  w
<>ublic Property Get AllVars ''[bool] Gets if all variables will be displayed.
* R' H% \" B' m5 A7 {6 i; t% {   AllVars = dbg_AllVars
* K) d" |2 n. p( K: T) m; cEnd Property </P>  a: p3 H6 ~  O3 i
<>'***********************************************************
7 ~9 h/ W- |9 G4 ^; U9 A. b3 s''@SDESCRIPTION: Adds a variable to the debug-informations.   W# {+ L* I, W2 F1 L' c# m4 P
''@PARAM:  - label [string]: Description of the variable
3 U7 m/ F+ w$ I7 \, A2 g/ U' G''@PARAM:  - output [variable]: The variable itself : W$ d' ^. {0 R1 t' O" S- p/ p
'***********************************************************
# a. Y  ?# ?3 k+ R  `Public Sub Print(label, output)
/ Z* _: t' [. N3 C   If dbg_Enabled Then
% p- T+ v  s' k) y     if err.number &gt; 0 then + S& q) q) S  o3 D
       call dbg_Data.Add(ValidLabel(label), "!!! Error: " &amp; err.number &amp; " " &amp; err.Description)
2 A) b  z. f2 g( O0 }       err.Clear 9 A' u! r5 H+ J) O& [
     else
. z1 ]3 S4 H" q" g( B. ^0 q% U9 v1 |       uniqueID = ValidLabel(label) + Z# E; h1 f4 _. ]* e+ Y
       response.write uniqueID
/ A3 h8 l# s! k6 K0 y& ?' q3 G- k       call dbg_Data.Add(uniqueID, output) ( Q0 U# k7 w$ {. H$ s+ s- L
     end if
# [7 ?% E/ X  S6 V$ D   End If
# u# ~; C9 c1 k) jEnd Sub 5 \! N0 Q2 Z# c. b' q  [
  
5 _. c5 _% F7 ]' I'*********************************************************** % w$ J9 R0 K1 `+ o
'* ValidLabel
' p: L$ K% q) d) T1 U, F: U, ~'*********************************************************** ! r! |+ n0 V( b8 d
Private Function ValidLabel(byval label)
  w- o) h# j& g& }* `' ?* X2 l. E- n   dim i, lbl
5 q+ m  D( O8 }0 ?   i = 0 " \; P3 S2 P- v$ X# a, I( }
   lbl = label
( ^, x- q9 q7 q+ [1 A   do
$ c6 Z# g) C3 i$ V5 }6 H   if not dbg_Data.Exists(lbl) then exit do 3 x# ?  h0 Q0 ^* y/ b' z0 P* {
   i = i + 1
+ N/ ^5 x2 {- `9 K, E8 m9 d   lbl = label &amp; "(" &amp; i &amp; ")"
# |" y0 h3 v3 f! E1 y" ?   loop until i = i
2 H* v% s+ R, K6 o2 O  + B/ U: A2 @& L* P6 @5 o
   ValidLabel = lbl
% Z+ i" B- `& d1 i8 h: C5 e% y5 H6 X: u- U/ SEnd Function
+ b- I. F9 k4 K5 |4 u7 K  
* M! b* l0 x# h5 p/ [: R'*********************************************************** # O8 F% }. {( W# X' I# ~
'* PrintCookiesInfo - T2 Q7 K& w* R1 ]. A% A, z+ _% c
'***********************************************************
9 p) C4 e  L. ^. oPrivate Sub PrintCookiesInfo(byval DivSetNo)
# S; u* t4 b0 f$ l9 \1 G4 z   dim tbl, cookie, key, tmp . `2 Z6 s5 T; G; s' N" n
   For Each cookie in Request.Cookies
# B6 \" j# J8 I4 T  @8 h! x   If Not Request.Cookies(cookie).HasKeys Then # o( F+ n  c0 c4 m2 J
     tbl = AddRow(tbl, cookie, Request.Cookies(cookie))   - P7 y" s( r( @9 K" T# Q. Y
   Else ( y3 p. k5 t3 `
     For Each key in Request.Cookies(cookie) ! d, E5 I; A. e% D
     tbl = AddRow(tbl, cookie &amp; "(" &amp; key &amp; ")", Request.
; V* }" V, X' R4 P, b/ vCookies(cookie)(key))   
. y1 ?9 r* y& S, y+ `( ]   Next
+ |3 E. g, w9 g  Q& B3 ?$ |* ]   End If & D' F; Y0 D' P7 ?. O; ]' V7 \
   Next </P>0 }$ o# u- L  E/ ?3 Z: D
<>   tbl = MakeTable(tbl)
; |: K) j4 d2 m3 X' G* l! ~   if Request.Cookies.count &lt;= 0 then DivSetNo = 2 8 O7 h1 o, F1 H3 P/ Y/ r
   tmp = replace(replace(replace(DivSets(DivSetNo),"#sectname#","COOKIES"),"#title#","COOKIES"),"#data#",tbl) ' g8 }7 L* |7 t) O# z
   Response.Write replace(tmp,"|", vbcrlf) 4 J$ d4 A6 b- M9 O5 ^1 |4 P
end sub
, F( ~, G5 n7 K. V! `# `" p  
9 R9 E  R4 O9 r) ~* C0 K, ]'*********************************************************** ' J8 H' F, T, Z3 G3 [
'* PrintSummaryInfo 2 ^, C. D$ G/ h
'***********************************************************
4 [& b* _+ ~% ]8 t* d' R" RPrivate Sub PrintSummaryInfo(byval DivSetNo) , Y  @0 H& M+ B0 X1 o+ U/ b
   dim tmp, tbl 2 W6 X# U) Y' y
   tbl = AddRow(tbl, "Time of Request",dbg_RequestTime) 8 u1 I; S' l7 n- S9 @4 `1 d5 V
   tbl = AddRow(tbl, "Elapsed Time",DateDiff("s", dbg_RequestTime, dbg_FinishTime) &amp; " seconds") 4 F% P6 w* I7 ]0 z  P
   tbl = AddRow(tbl, "Request Type",Request.ServerVariables("REQUEST_METHOD")) ( n5 Y7 R  b$ R: G& {' |
   tbl = AddRow(tbl, "Status Code",Response.Status) ( L; x3 r. `- @5 x, z* N
   tbl = AddRow(tbl, "Script Engine",ScriptEngine &amp; " " &amp; ScriptEngineMajorVersion &amp; "." &amp; ScriptEngineMinorVersion &amp; "." &amp; ScriptEngineBuildVersion) : i& ?9 ^1 Z( d5 g* L7 q" q! _
   tbl = MakeTable(tbl) " g+ _) I0 }2 J* ^
   tmp = replace(replace(replace(DivSets(DivSetNo),"#sectname#","SUMMARY"),"#title#","SUMMARY INFO"),"#data#",tbl) 2 E  H) L. x0 f$ I
   Response.Write replace(tmp,"|", vbcrlf) ) \9 ?6 C7 h: C6 U9 A" S3 [" `- g+ }
End Sub </P>
- a7 H& a( }( @( h- ?* y<>'***********************************************************   S$ M! O0 ?! ]0 k/ @8 h1 ]0 K
''@SDESCRIPTION: Adds the Database-connection object to the debug-instance. To display Database-information 5 C+ U( H, O$ W0 L; o, A: ]
''@PARAM:  - oSQLDB [object]: connection-object / o& u6 y' g* D) h$ g
'***********************************************************
; z' n- G* Y. t/ L; H& QPublic Sub GrabDatabaseInfo(byval oSQLDB)
0 x) L6 g7 B9 {* [7 a   dbg_DB_Data = AddRow(dbg_DB_Data, "ADO Ver",oSQLDB.Version) % n5 Z0 h2 p4 Z
   dbg_DB_Data = AddRow(dbg_DB_Data, "OLEDB Ver",oSQLDB.Properties("OLE DB Version"))
$ p" t8 y: m7 r! a   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"))
9 C6 i0 [3 v" U8 g0 @5 ~- o   dbg_DB_Data = AddRow(dbg_DB_Data, "rovider",oSQLDB.Properties("rovider Name") &amp; " Ver: " &amp; oSQLDB.Properties("rovider Version")) , V- s( m, q" z5 v
End Sub <>'*********************************************************** ( M. N0 u' R2 q# k0 W7 L/ x
'* PrintDatabaseInfo . @* G. n! s2 R: a. \
'***********************************************************
( r* `  ]9 ]" K+ K( @" ~$ bPrivate Sub PrintDatabaseInfo(byval DivSetNo)
, z, i4 F* G& o  g1 ?7 h   dim tbl ! `* h6 Y; f: U8 |
   tbl = MakeTable(dbg_DB_Data)
' Z8 k2 [7 y+ y9 a+ e   tbl = replace(replace(replace(DivSets(DivSetNo),"#sectname#","DATABASE"),"#title#","DATABASE INFO"),"#data#",tbl)
% s% |( S, d& c! Y   Response.Write replace(tbl,"|", vbcrlf) ) R; U8 r4 A2 K3 S8 W! T4 s) K/ A$ l+ L, Z
End Sub </P><>'*********************************************************** ! m8 G+ s: P2 R* X8 T0 }
'* PrintCollection ! R& j# z6 ]3 [, ^) v7 B$ L; l
'***********************************************************
+ i8 x! m8 B0 Y3 W- I# wPrivate Sub PrintCollection(Byval Name, ByVal Collection, ByVal DivSetNo, ByVal ExtraInfo) / f, c: |# m3 h& \- X3 ?7 d& B( _) g
   Dim vItem, tbl, Temp
7 o' X) ]9 W1 `8 g* I; B& W   For Each vItem In Collection
- p8 @5 q4 h$ h, W     if isobject(Collection(vItem)) and Name &lt;&gt; "SERVER VARIABLES" and Name &lt;&gt; "QUERYSTRING" and Name &lt;&gt; "FORM" then " b9 A7 W  n# z) r8 t+ M
       tbl = AddRow(tbl, vItem, "{object}") & W/ J( i, @3 {& F5 K4 X
     elseif isnull(Collection(vItem)) then
& F) D  H8 S" X7 M+ D, q5 K1 U       tbl = AddRow(tbl, vItem, "{null}")
* \8 ]/ \5 r$ M. E6 e. Q     elseif isarray(Collection(vItem)) then 7 Z! @+ d1 E; ~% B* R! K
       tbl = AddRow(tbl, vItem, "{array}")
7 {* A/ U9 I: ?# S     else 2 u' H/ Q$ D$ b# X
       if dbg_AllVars then * X: \2 `! ?" R* \5 v0 D" n8 H( ?
       tbl = AddRow(tbl, "&lt;nobr&gt;" &amp; vItem &amp; "&lt;/nobr&gt;", server.HTMLEncode(Collection(vItem)))
3 b0 g5 W, C( a. X( f     elseif (Name = "SERVER VARIABLES" and vItem &lt;&gt; "ALL_HTTP" and vItem &lt;&gt; "ALL_RAW") or Name &lt;&gt; "SERVER VARIABLES" then 8 j3 C- B# Q7 R/ S  D
       if Collection(vItem) &lt;&gt; "" then 2 c- c/ ?7 g4 k9 l) g( j
       tbl = AddRow(tbl, vItem, server.HTML
/ w" t) w4 h' z4 M. zEncode(Collection(vItem))) ' &amp; " {" &amp; TypeName(Collection(vItem)) &amp; "}") 2 k5 \% Q% M. b$ S6 z5 X, c2 q* d% J
       else & j0 W9 b: q' `
       tbl = AddRow(tbl, vItem, "...") & W) p/ }* ?$ x) _- \6 k( w
       end if   T1 O+ _, _! q: X  _7 O' I9 E: D
     end if + U" G5 n; G+ ?, P0 @' X0 `
   end if 1 j7 |6 y/ `7 L" c
   Next
4 b9 F( ?) K$ u2 Z   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 K1 W' I/ z; D+ Y( n& m
   tbl = MakeTable(tbl)
0 q# z' u% I7 P- d3 _3 {  d   if Collection.count &lt;= 0 then DivSetNo =2
+ X' E+ `0 |- J2 d+ v+ U     tbl = replace(replace(DivSets(DivSetNo),"#title#",Name),"#data#",tbl)
6 C0 s! P3 g  X, A: {     tbl = replace(tbl,"#sectname#",replace(Name," ","")) * L* S2 x- q+ u6 M
     Response.Write replace(tbl,"|", vbcrlf) 1 z$ n# R0 q0 s, b
End Sub
8 ^3 @! i8 c- {$ K1 X+ K1 L6 C- }  
$ g" ?+ {4 K+ [. O'***********************************************************
. c0 J) x4 F1 ~9 G' b6 Q# D'* AddRow / E; }2 f: \7 V- b* D
'***********************************************************
) \$ \7 K5 }& J& E$ r5 SPrivate Function AddRow(byval t, byval var, byval val) / I( y* l' [  W! h5 h+ O: z
   t = t &amp; "|&lt;TR valign=top&gt;|&lt;TD&gt;|" &amp; var &amp; "|&lt;TD&gt;= " &amp; val &amp; "|&lt;/TR&gt;" % |& ^5 x" c3 |. s4 O
   AddRow = t . R1 n5 k+ H6 j) ?9 X
End Function </P><>'*********************************************************** 1 I5 q9 |) V2 i( s$ A3 q5 s6 Q
'* MakeTable + ?6 n! X$ n  }( R+ b) e- U( j
'***********************************************************
: c- f% p& {' m' k% n$ zPrivate Function MakeTable(byval tdata)
3 D9 u& z1 ?1 {! @   tdata = "|&lt;table border=0 style=""font-size:10pt;font-weight:normal;""&gt;" + tdata + "&lt;/Table&gt;|"
7 e" }( i3 S: K  y   MakeTable = tdata 7 ~7 c/ A/ _* H$ M- _( F
End Function </P><>'***********************************************************
0 k# y( Y2 p2 m''@SDESCRIPTION: Draws the Debug-panel 2 r$ k0 U, Z  K- w
'***********************************************************
* P7 R& M' m+ S; _  Y3 ^/ ~Public Sub draw()
  I8 c1 O3 d5 R   If dbg_Enabled Then . Y& O, w# x5 ^7 E$ w
     dbg_FinishTime = Now()
( y& e- ]7 z% q1 i% K  
: i8 O( i6 O( q3 C+ ?   Dim DivSet, x
0 M" {6 j- @- |/ U8 x   DivSet = split(dbg_Show_default,",") 8 J  E5 `, s8 l, P/ d
     dbg_Show = split(dbg_Show,",") & l: B  s" z: @% O  P+ ]4 w- M3 [, ^
  
/ V# G. y/ R' A, d3 A& X+ P+ d! u   For x = 0 to ubound(dbg_Show) 2 ?, \. x% i+ v* E$ d' h3 J2 k: R
     divSet(x) = dbg_Show(x) " k2 C! n/ u  |* Z4 w# {  J% l8 ?
   Next
4 [3 Y9 a3 N7 m/ y  t$ C  4 E9 F# _; i3 U7 b5 `
   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;"
+ |* }* E: h( `, v0 I( c   Call PrintSummaryInfo(divSet(0)) 2 \* S& e0 ?3 F/ I$ O( X
     Call PrintCollection("VARIABLES", dbg_Data,divSet(1),"")
6 j4 a! `8 e& I. L; c, Y; m    Call PrintCollection("QUERYSTRING", Request.QueryString(), divSet(2),"") ' V' b( w. c3 V# _( t
    Call PrintCollection("FORM", Request.Form(),divSet(3),"") & e0 _# T7 M" z- \1 [( g
    Call PrintCookiesInfo(divSet(4))
5 O  y5 t9 w3 }* x, D7 G    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))
6 U% t  P6 u% B: ]  R" b7 ]" `    Call PrintCollection("APPLICATION", Application.Contents(),divSet(6),"") 9 N3 e8 r5 Y3 T. K
    Call PrintCollection("SERVER VARIABLES", Request.ServerVariables(),divSet(7),AddRow("","Timeout",Server.ScriptTimeout)) 5 ^0 ?( B: b9 ]& \- P4 |; y0 G6 {
    Call PrintDatabaseInfo(divSet(8)) - h5 X0 ^9 }( f: ]" s
    Call PrintCollection("SESSION STATIC OBJECTS", Session.StaticObjects(),divSet(9),"") 2 l5 e; u6 \' H3 F7 Z
    Call PrintCollection("APPLICATION STATIC OBJECTS", Application.StaticObjects(),divSet(10),"")
4 X) A7 I6 H8 g9 o( F/ Q8 I    Response.Write "&lt;/Table&gt;" : z7 w! w# k! i7 \# w
   End If & \; _& F% w8 q+ K1 l
End Sub </P><>'Destructor
. M7 j0 L  d& n* o4 ^2 j6 L: B: A  dPrivate Sub Class_Terminate()
) X; ~# y' ^6 ?4 Z6 _7 U  G   Set dbg_Data = Nothing
# x1 f3 I' j$ nEnd Sub </P><>End Class </P><>%&gt; </P><>类的说明: </P><>. s. N& W/ D4 N8 O& O4 d
CLASS debuggingConsole
) w& M/ F" m, C7 L' ?! tVersion: 1.2 </P><>-------------------------------------------------------------------------------- </P><>ublic Properties </P><>roperty Let Enabled(bNewValue)===[bool] Sets "enabled" to true or false + M% C( @! _% b0 P
&amp;n% _% q1 m% k3 _) s+ g  L
bsp;
( M7 ~1 w% T3 C' ^. }1 G1 {Property Get Enabled===[bool] Gets the "enabled" value - ?7 Z) \' P& d4 I. `7 q9 k$ U
  
) b) F' Z& L6 H6 ~  s- P! p7 j8 _: s) OProperty 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 9 A  A3 U1 u6 a0 p% p( B1 W& R
  + D" G/ L0 e6 @4 w9 O
Property Get Show===[string] Gets the debugging panel. - {1 {+ W5 z9 P4 t2 \4 A
  
7 H1 b# ]# @6 j- x3 z( F* wProperty 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 P9 G- b; f8 O. OPublic Methods </P><>public sub===Print (label, output)   h. s0 V: f7 K* y2 ^/ }
   Adds a variable to the debug-informations.  </P><>public sub===GrabDatabaseInfo (byval oSQLDB)
3 t+ ?8 |6 c' _1 _# G' s/ _   Adds the Database-connection object to the debug-instance. To display Database-information  </P><>public sub===draw ()
5 j$ z4 a: R3 b; P   Draws the Debug-panel  </P><>--------------------------------------------------------------------------------
- k9 k% a% L( l9 D, j$ W. E* uMethods Detail
5 U) `) V2 @9 t* y7 k  
2 F9 O/ s6 x, A  D3 O2 n/ u+ Qpublic sub===Print (label, output)
% x) J. \- I% j5 e5 d8 C1 jParameters:  
  [5 G: h8 b7 R( _5 t9 R   - label [string]: Description of the variable
8 P& H9 [1 \. s2 v- Y   - output [variable]: The variable itself
8 l2 w4 ~+ C& ^: v+ a% }  
: F4 t2 N: d& [# z- _% S) u9 zpublic sub===GrabDatabaseInfo (byval oSQLDB)
1 \0 ]0 @3 V, F# WParameters:  
8 a6 |) H3 l5 L: q   - oSQLDB [object]: connection-object</P>




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