数学建模社区-数学中国

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

作者: 韩冰    时间: 2004-11-21 11:43
标题: ASP中令人震撼的Debug类(VBScript)
<>不知道用ASP写代码的朋友是不是和我有一样的感受,ASP中最头疼的就是调试程序的时候不方便,我想可能很多朋友都会用这样的方法“response.write ”,然后输出相关的语句来看看是否正确。前几天写了一个千行的页面,里面大概有七八个SUB/FUNCTION,调试的时候用了有三十几个response.write ,天,调试完后把这三十个一个个删除,累! </P>4 K0 r7 |$ O' }+ l3 T" b
<>今天看到一个ASP中的Debug类(VBS),试用了一下,绝!
# l% M$ @# R# X0 c" ~使用方法很简单: $ r: F/ p6 G" F- u
test.asp </P>
0 R6 L0 C( o/ x<>&lt;!--#INCLUDE FILE="debuggingConsole.asp"--&gt; " X% G1 |6 @- [9 A* m
&lt;%
+ d- |' G% w, Z1 e( Ioutput="XXXX"
  A6 C0 {% R$ P  o% b& |9 C% d6 ~+ @Set debugstr = New debuggingConsole
$ L6 O/ y8 @, n7 ]$ r, {$ z; }debugstr.Enabled = true   D( ~" Y+ e/ k
   debugstr.Print "参数output的值", output
2 S' B" Y; D2 ^% U( w   '……
0 I2 a. r2 \# \8 v  _   debugstr.draw
8 I# K. q( m3 O, A' t; iSet debugstr = Nothing
# a3 u' V3 \3 Y3 t% P%&gt; </P>4 \7 E' J/ m7 Y" q# Z* i4 i8 n
<>=================================================== </P>7 @$ Q! S3 }/ v6 K2 ^$ j& J
<>debuggingConsole.asp </P>, R- [- [# i: m, ^  X) T' f" t
<>&lt;%
" y7 I! G; s8 f* Z. C' \$ ^Class debuggingConsole </P>0 ~$ ?$ x  v( k( Q$ w3 L$ [/ u
<>   private dbg_Enabled 1 Q( j+ V$ E6 c* ~" S  m2 ^
   private dbg_Show 0 ~) H* O% O- c( {: U2 K7 y9 R
   private dbg_RequestTime / J8 w% _  m1 U) _8 q4 I0 ]! `' Q% R
   private dbg_FinishTime
* a: E7 m) z3 a& [; |1 q4 b   private dbg_Data ) T0 v. y; E) L6 z4 c. ~
   private dbg_DB_Data 1 U& W( {% }& I# H+ p- c% t9 u# V/ F) S
   private dbg_AllVars
' K' N- P& @5 a$ b/ @7 i  t+ D   private dbg_Show_default   @: s4 `* n4 P8 T! F6 F9 {3 P/ p
   private DivSets(2) ' G  w! _! G8 X2 a
   
$ S3 r3 q5 E/ Z7 _/ w'Construktor =&gt; set the default values 3 B  ^# E) F/ f4 f2 b  M" o
Private Sub Class_Initialize() * e- j, n/ C  o
   dbg_RequestTime = Now()
+ Y" a: d. H8 v3 [/ h   dbg_AllVars = false " l0 Y. w$ ^0 S% S' G' |+ F
   Set dbg_Data = Server.CreateObject("Scripting.Dictionary") </P>
- q) k4 q; C2 S- v6 r- H. G" 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>
$ N. `% o: a5 A  l$ O<>   DivSets(1) = "&lt;TR&gt;&lt;TD&gt;( s' \* e/ M# W5 e8 C) ?7 J
&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>
% h5 @: X8 ?$ Q5 l<>   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>
0 g7 q& h7 t6 O" N3 a# W- j<>   dbg_Show_default = "0,0,0,0,0,0,0,0,0,0,0"
) i2 _8 _5 q3 |$ n: zEnd Sub </P>
$ b0 p8 h, G' }* V0 U<>ublic Property Let Enabled(bNewValue) ''[bool] Sets "enabled" to true or false
4 m5 s' ?; C# G9 C   dbg_Enabled = bNewValue
2 ^7 S: ]: B) b+ K1 Q* IEnd Property </P>7 L& F! [  e# x
<>ublic Property Get Enabled ''[bool] Gets the "enabled" value 9 D* J2 c5 A3 \6 X) S# O8 r
   Enabled = dbg_Enabled
- F- q4 E9 d( B/ T9 w  a) TEnd Property </P>
& S& `4 J4 w0 Y3 _; v3 f<>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
* Z) ], [; f. `9 v! c   dbg_Show = bNewValue " N) u$ l/ G2 }  Z+ d) v1 M0 p% p
End Property </P>- H* A9 P1 O% z& G3 y# I
<>ublic Property Get Show ''[string] Gets the debugging panel.
5 ^) Q6 D  B% a# `* h) a# O1 b   Show = dbg_Show
! P- E* M' C3 d  b1 F& z- s( FEnd Property </P>' i" P" C5 q- l
<>ublic Property Let AllVars(bNewValue) ''[bool] Sets wheather all variables will be displayed or not. true/false
+ X2 p7 x- }% i, i   dbg_AllVars = bNewValue : V. I1 q; ~1 S- j
End Property </P>
) n; c  l; ~) c* [  b  X8 d<>ublic Property Get AllVars ''[bool] Gets if all variables will be displayed.
# P. c% F7 z1 q+ L% ~9 Q   AllVars = dbg_AllVars
. s" J- }; A  w$ m$ x4 z6 A9 ^End Property </P>
4 p) v" P2 p$ }' j" a' U  p<>'*********************************************************** 7 i1 ], e* N) C) C: p
''@SDESCRIPTION: Adds a variable to the debug-informations.
8 X  b$ K8 O3 x* ]# c''@PARAM:  - label [string]: Description of the variable 2 g( X7 N' [  p
''@PARAM:  - output [variable]: The variable itself 5 [1 y: ]% n+ ~
'*********************************************************** 1 x  _# d- \: g
Public Sub Print(label, output) ( s9 x- C8 ^; c& L, Q( a
   If dbg_Enabled Then . o1 f/ p! B: Q
     if err.number &gt; 0 then 7 _7 Q' N& V* |. Z/ F: s) O
       call dbg_Data.Add(ValidLabel(label), "!!! Error: " &amp; err.number &amp; " " &amp; err.Description)
' C" J- _/ `% G% @; C5 ]7 X       err.Clear
, X4 C6 ^- i$ \8 F4 e6 ^2 |6 M     else
" c. ~- R' K. s" `6 U       uniqueID = ValidLabel(label) 2 p, r" D; a- Y6 h: c" t2 {
       response.write uniqueID ) b6 R) Y: M: `. b+ M0 b4 [# `! w
       call dbg_Data.Add(uniqueID, output)
0 Y6 P3 ]& ^, T' ?$ c     end if   ^' ~5 R$ @' k( W- j
   End If
; q& o4 h1 L1 M, p3 d  u6 XEnd Sub 1 v8 J+ d3 x2 V$ \+ p
    Q4 C2 X8 U4 E7 J6 F! Y1 J& T9 @' b
'***********************************************************
! m# l& O2 j8 w" M# @4 K'* ValidLabel
/ S' q2 Y0 |; s'***********************************************************
' `) `9 E/ v1 ?" {Private Function ValidLabel(byval label) ' D* J$ q6 F5 j; O& W  W
   dim i, lbl 2 E  t+ Q: _9 W
   i = 0 8 K/ d, k' y% v0 B! j
   lbl = label   v2 ~+ N0 z- `) N+ X
   do . ^0 T  V: l) H' i" V
   if not dbg_Data.Exists(lbl) then exit do 1 ]- |# C1 m) |: o: x
   i = i + 1
2 Q- x! Z- ?/ x. U7 R& R   lbl = label &amp; "(" &amp; i &amp; ")" , d. U, \' N, Z+ J6 _# |  o9 a
   loop until i = i
; j* D/ x; M2 d# b" [! E: }  
% H9 {5 v8 Y& t6 T   ValidLabel = lbl
+ }) `" h0 i9 hEnd Function " C8 l$ ^+ q5 ^" e( [) i
  
5 [$ g. x) j3 r+ N( @, K  f'***********************************************************
% s: X: M0 G% J'* PrintCookiesInfo / D! z0 u7 r# l
'*********************************************************** . g, k: K& U/ n" x  D
Private Sub PrintCookiesInfo(byval DivSetNo)
4 K# F6 r0 s' J' \7 ~+ v   dim tbl, cookie, key, tmp
+ G3 m: m* }1 Y2 q, O+ u+ T' Q6 I   For Each cookie in Request.Cookies / i# R% p  k+ x
   If Not Request.Cookies(cookie).HasKeys Then
- }/ o7 _- F. O& ?3 V% U3 c     tbl = AddRow(tbl, cookie, Request.Cookies(cookie))   ! ^5 E5 M+ C6 f2 j' c. ~8 ^
   Else 3 l8 n, w, [9 f/ ]$ ^( m1 H( R
     For Each key in Request.Cookies(cookie) % T0 F$ Q* L& b$ I* h$ c. b
     tbl = AddRow(tbl, cookie &amp; "(" &amp; key &amp; ")", Request.
5 m2 {5 |7 B9 YCookies(cookie)(key))   % }* R  A& y0 [1 ^) P8 `5 a
   Next " ~! A/ o" w, H/ M- R  ~
   End If   m2 i& X- L) g3 M* Z: B1 W, A' _# l
   Next </P>
8 j2 ?- B# `! c0 c4 [5 a<>   tbl = MakeTable(tbl) / o9 V/ D5 A, k8 L" |7 d
   if Request.Cookies.count &lt;= 0 then DivSetNo = 2 % t5 x% r3 h# I5 I0 M
   tmp = replace(replace(replace(DivSets(DivSetNo),"#sectname#","COOKIES"),"#title#","COOKIES"),"#data#",tbl)
9 ?0 b' ~4 S5 A  X# d   Response.Write replace(tmp,"|", vbcrlf) * w/ g2 X" z( Y0 E: a
end sub / a0 T9 o3 X4 v. i
    \! H8 d3 m2 t1 C
'***********************************************************
8 l8 T6 }, m9 E% L'* PrintSummaryInfo 2 D. s, m8 z: a( w
'*********************************************************** 0 |+ _1 h, Y" V8 o! r* E
Private Sub PrintSummaryInfo(byval DivSetNo) 5 V" n5 m) t" Y, c' W0 {! k  s
   dim tmp, tbl 6 d9 a$ f5 v9 ^( C
   tbl = AddRow(tbl, "Time of Request",dbg_RequestTime)
2 P5 v5 T4 g$ l: `" C   tbl = AddRow(tbl, "Elapsed Time",DateDiff("s", dbg_RequestTime, dbg_FinishTime) &amp; " seconds")
0 _* _9 J2 p8 O: s- \( \3 R) o   tbl = AddRow(tbl, "Request Type",Request.ServerVariables("REQUEST_METHOD")) 9 ^8 p1 |4 d. b0 m/ ^/ `0 x
   tbl = AddRow(tbl, "Status Code",Response.Status) 6 e0 `: V4 D- ~7 G/ K, C
   tbl = AddRow(tbl, "Script Engine",ScriptEngine &amp; " " &amp; ScriptEngineMajorVersion &amp; "." &amp; ScriptEngineMinorVersion &amp; "." &amp; ScriptEngineBuildVersion) ) h$ c* C& R4 M  h: t, R+ r
   tbl = MakeTable(tbl) & G3 P# W- P" L3 S, t
   tmp = replace(replace(replace(DivSets(DivSetNo),"#sectname#","SUMMARY"),"#title#","SUMMARY INFO"),"#data#",tbl)
5 {4 |  A4 {4 z4 @; ]+ r   Response.Write replace(tmp,"|", vbcrlf)
2 |8 U' ~$ @7 O0 JEnd Sub </P>* J! v0 a8 ~' x, F
<>'*********************************************************** : ^. H" y0 Z4 [& W5 q, K
''@SDESCRIPTION: Adds the Database-connection object to the debug-instance. To display Database-information
) F6 r9 Q$ \$ U0 B0 b) k: y''@PARAM:  - oSQLDB [object]: connection-object
4 B8 }6 F9 D8 B# w! O'***********************************************************
/ F; z8 p( `* D% W% \/ CPublic Sub GrabDatabaseInfo(byval oSQLDB) , E7 Q2 z9 V( k; [" \! w& t
   dbg_DB_Data = AddRow(dbg_DB_Data, "ADO Ver",oSQLDB.Version) ; K0 i4 c8 G1 u' n0 |  B8 Y
   dbg_DB_Data = AddRow(dbg_DB_Data, "OLEDB Ver",oSQLDB.Properties("OLE DB Version")) & z( W; s7 G0 A$ a& ?/ w
   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"))
; R2 U0 v1 m6 G   dbg_DB_Data = AddRow(dbg_DB_Data, "rovider",oSQLDB.Properties("rovider Name") &amp; " Ver: " &amp; oSQLDB.Properties("rovider Version")) $ \# ~( ^9 e- o- W$ C
End Sub <>'*********************************************************** ( @3 {, J8 M; T# {) A& x
'* PrintDatabaseInfo ' k% L- l- X5 A5 {$ p# z( Y! v# J
'***********************************************************
! E6 N' X/ i- ?9 K- F1 H3 _Private Sub PrintDatabaseInfo(byval DivSetNo)
( Z* B3 M; [/ y1 o. A6 a  n   dim tbl
3 I% p# `' e! ?0 e! C   tbl = MakeTable(dbg_DB_Data)
- Q! |8 o( L  w0 W8 [   tbl = replace(replace(replace(DivSets(DivSetNo),"#sectname#","DATABASE"),"#title#","DATABASE INFO"),"#data#",tbl) + O+ R2 J& D1 j  o+ @8 e! C
   Response.Write replace(tbl,"|", vbcrlf) ' V" U: r/ S3 l9 F
End Sub </P><>'*********************************************************** : F: `: N+ n. _- M1 ?
'* PrintCollection
, W3 b! \* A! _# i* w! D'*********************************************************** 0 z! y; o# h1 K, {
Private Sub PrintCollection(Byval Name, ByVal Collection, ByVal DivSetNo, ByVal ExtraInfo)
6 O+ A" |. c' Q7 r$ v8 u, P% c   Dim vItem, tbl, Temp
, A, G4 Z! u' h6 X/ l   For Each vItem In Collection
& `0 o6 l# A8 J5 q/ u0 N0 C/ P     if isobject(Collection(vItem)) and Name &lt;&gt; "SERVER VARIABLES" and Name &lt;&gt; "QUERYSTRING" and Name &lt;&gt; "FORM" then
% m2 |7 g' X' r4 l1 b, K# P4 q       tbl = AddRow(tbl, vItem, "{object}")
: j/ p+ g  a1 D  E     elseif isnull(Collection(vItem)) then
: ]' x) @" e3 f) R  W# M5 m       tbl = AddRow(tbl, vItem, "{null}")
+ K4 V% H$ Y- E' K     elseif isarray(Collection(vItem)) then   y& c  Z( L) F; E: c1 ]
       tbl = AddRow(tbl, vItem, "{array}")
4 p& S" M& h& ^, X/ q3 b     else 4 h( _% }. x/ ?# Y1 I: M: \
       if dbg_AllVars then 1 }- d7 ~- z6 n0 {" G. v4 I( r
       tbl = AddRow(tbl, "&lt;nobr&gt;" &amp; vItem &amp; "&lt;/nobr&gt;", server.HTMLEncode(Collection(vItem)))
8 r/ k) h% S6 a8 E; b) z     elseif (Name = "SERVER VARIABLES" and vItem &lt;&gt; "ALL_HTTP" and vItem &lt;&gt; "ALL_RAW") or Name &lt;&gt; "SERVER VARIABLES" then
7 t2 j1 u6 B  ~9 J, ~       if Collection(vItem) &lt;&gt; "" then
8 ]- o3 I% R# K' ]1 b       tbl = AddRow(tbl, vItem, server.HTML
% l: G$ q0 a2 Q. g% K& lEncode(Collection(vItem))) ' &amp; " {" &amp; TypeName(Collection(vItem)) &amp; "}")
) _1 V5 d2 Z9 D) c2 d       else % j, u. F/ ^: |: \0 W5 ]
       tbl = AddRow(tbl, vItem, "...")
8 O. U' b9 P4 V( }* u% q, O       end if
2 g7 g/ r% W, Z9 g! Z( j0 O     end if ' A7 ^% V4 o. B1 j9 I
   end if 0 [3 {5 a9 J* f# H+ m
   Next
. e, C- i6 B) l: {# o, G  Q4 ?) h5 {   if ExtraInfo &lt;&gt; "" then tbl = tbl &amp; "&lt;TR&gt;&lt;TD COLSPAN=2&gt;&lt;HR&gt;&lt;/TR&gt;" &amp; ExtraInfo & l) i( W" u1 A$ g$ q
   tbl = MakeTable(tbl)
8 i2 ?$ Z( p& c$ }4 v% A4 p: T: Q   if Collection.count &lt;= 0 then DivSetNo =2
: t# j( i4 {* F# k2 z# Y3 E     tbl = replace(replace(DivSets(DivSetNo),"#title#",Name),"#data#",tbl) . r% [' K4 Q. b# v2 z* i3 a
     tbl = replace(tbl,"#sectname#",replace(Name," ","")) - L! J: T) z- F
     Response.Write replace(tbl,"|", vbcrlf) 2 ?9 H1 \1 h9 M* V# E$ M5 U
End Sub
% e) L; Q& A' N" u! E  
9 r1 J3 b0 l. a! Q  q2 D5 y2 g9 q'***********************************************************
5 D- w: L- t# g. V, P'* AddRow
  x/ K) {5 ?0 L# {; f6 x' c/ k' o" J'***********************************************************
( _3 j! n5 N0 S2 S8 y% U: O6 lPrivate Function AddRow(byval t, byval var, byval val) 9 p, D  J$ x" h+ k0 e2 x/ D
   t = t &amp; "|&lt;TR valign=top&gt;|&lt;TD&gt;|" &amp; var &amp; "|&lt;TD&gt;= " &amp; val &amp; "|&lt;/TR&gt;" & X- h; v7 i/ O9 b( x' G
   AddRow = t ; w9 E+ \; y8 K
End Function </P><>'*********************************************************** ) Q) |% C* f0 e" k, ?- |* h. m
'* MakeTable " y$ Q7 {& x  }* d& |
'*********************************************************** 8 Z5 ]: \7 i* z: Z$ z5 v
Private Function MakeTable(byval tdata)
0 ^! A3 l2 X, i& N! Q   tdata = "|&lt;table border=0 style=""font-size:10pt;font-weight:normal;""&gt;" + tdata + "&lt;/Table&gt;|"
, v- j7 y/ i6 P: x/ ^   MakeTable = tdata " I. Q4 m1 g+ W* K, j/ {% S; Z! z
End Function </P><>'*********************************************************** 4 l- [# A; Y0 t
''@SDESCRIPTION: Draws the Debug-panel 1 A! Q- L* m1 _" {, F; A, F4 o
'***********************************************************
% _4 i- l. z3 S* `- [  _. HPublic Sub draw()
! Q6 ^6 s- G; g8 e   If dbg_Enabled Then
! r% T2 _1 p' B1 ~% u: K  P: G     dbg_FinishTime = Now()
" p/ }* k- F$ m/ _3 O" ^% a  
) s1 o+ s: y( C# T6 _2 e$ C$ v   Dim DivSet, x
0 ~! O# \$ B+ c+ v% h   DivSet = split(dbg_Show_default,",") / w" x& r( y9 \
     dbg_Show = split(dbg_Show,",") 1 q- h# }0 s* x& W6 T8 G/ ^
  % N5 V2 y* v: n9 O
   For x = 0 to ubound(dbg_Show) 1 F: v% V2 K- c
     divSet(x) = dbg_Show(x)
  X% G) u8 @6 a6 x8 a5 m   Next ) V/ _  d! l! I5 q. R
  , v7 J6 l" h/ F3 |& V
   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;"
6 t" l0 P5 X! t, a" L   Call PrintSummaryInfo(divSet(0))
7 `+ a- {( }* y% z+ M' c: b# A, t( }     Call PrintCollection("VARIABLES", dbg_Data,divSet(1),"")
0 P! p3 x% v8 A9 x& j: ^6 ?8 Q    Call PrintCollection("QUERYSTRING", Request.QueryString(), divSet(2),"")
: q$ \0 v1 U9 v2 N    Call PrintCollection("FORM", Request.Form(),divSet(3),"") 5 ~  z7 T4 V7 e: T
    Call PrintCookiesInfo(divSet(4)) + ^7 d4 ?6 B9 Z0 U3 Y
    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)) / v  f# _4 P7 `; f3 m  q1 H8 k
    Call PrintCollection("APPLICATION", Application.Contents(),divSet(6),"")
5 y# V4 _2 h+ W) P    Call PrintCollection("SERVER VARIABLES", Request.ServerVariables(),divSet(7),AddRow("","Timeout",Server.ScriptTimeout)) , W, G. h/ M0 E# K, q
    Call PrintDatabaseInfo(divSet(8)) 7 `2 e' W. J! W3 G7 `# u
    Call PrintCollection("SESSION STATIC OBJECTS", Session.StaticObjects(),divSet(9),"") # X+ j3 e) q7 s/ t) ?' \. R9 S6 R
    Call PrintCollection("APPLICATION STATIC OBJECTS", Application.StaticObjects(),divSet(10),"") 4 T. P9 F" E5 Q) P( p' Y4 Z
    Response.Write "&lt;/Table&gt;" & m. v  ?. @% v: R7 v% B( Z) O
   End If
" I9 r+ J: l- Q/ m' c/ B7 {End Sub </P><>'Destructor
, y4 y! E9 l1 c7 ZPrivate Sub Class_Terminate()
8 m) c7 |7 f/ ^   Set dbg_Data = Nothing . Q7 V6 N1 z# @: e% ?( H4 u$ b
End Sub </P><>End Class </P><>%&gt; </P><>类的说明: </P><>* ]1 M" f1 U5 G9 F# y# R# U7 P1 X
CLASS debuggingConsole
2 G+ M$ _; l* tVersion: 1.2 </P><>-------------------------------------------------------------------------------- </P><>ublic Properties </P><>roperty Let Enabled(bNewValue)===[bool] Sets "enabled" to true or false
3 K' I! V) B. l" w4 }&amp;n
' K1 q; c, V2 Lbsp;
1 a; A# e' B! \  FProperty Get Enabled===[bool] Gets the "enabled" value , ^& \! R- j4 B6 ~+ D- C1 W
  
  ~0 [3 A, u' h$ l/ R7 g- U$ V; W6 w9 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   b+ L  p* a! u. X) u) D( d
  . {" \( O: Y3 ^7 \& C" S+ E: Z) R
Property Get Show===[string] Gets the debugging panel.
; U3 t& h) o0 Y  
$ G0 j2 @8 t$ I! _, LProperty 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><>--------------------------------------------------------------------------------
$ H7 P! o2 V/ }1 {8 w# n7 Z' UPublic Methods </P><>public sub===Print (label, output) # \9 J8 H1 j' Y; T, L
   Adds a variable to the debug-informations.  </P><>public sub===GrabDatabaseInfo (byval oSQLDB)
1 A; |  Q9 M- t6 G/ p/ L$ T. G/ v8 l   Adds the Database-connection object to the debug-instance. To display Database-information  </P><>public sub===draw ()
4 ~3 ?- \9 |/ w) k. u, U, @   Draws the Debug-panel  </P><>-------------------------------------------------------------------------------- 0 j* Z0 W' K, [. E/ u& K) _2 G$ \
Methods Detail
5 X6 Z: I0 e$ d* g  
# l$ g: b* T: y! h* S; C' Mpublic sub===Print (label, output)
. _  V9 B* j, OParameters:  
# O& _& b8 C6 |3 `  H5 C   - label [string]: Description of the variable ) ?3 J% }: b: T2 l3 y
   - output [variable]: The variable itself # _0 a: ~5 n  U; N" _
  
  K% g" B3 u* ]7 Ypublic sub===GrabDatabaseInfo (byval oSQLDB)
2 o- s! a! U6 [3 F: xParameters:  & W" P' X4 X: F. ]% _$ [% e' G; q# I
   - oSQLDB [object]: connection-object</P>




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