QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 6634|回复: 1
打印 上一主题 下一主题

ASP中令人震撼的Debug类(VBScript)

[复制链接]
字体大小: 正常 放大
韩冰        

823

主题

3

听众

4048

积分

我的地盘我做主

该用户从未签到

发帖功臣 元老勋章

跳转到指定楼层
1#
发表于 2004-11-21 11:43 |只看该作者 |倒序浏览
|招呼Ta 关注Ta
<>不知道用ASP写代码的朋友是不是和我有一样的感受,ASP中最头疼的就是调试程序的时候不方便,我想可能很多朋友都会用这样的方法“response.write ”,然后输出相关的语句来看看是否正确。前几天写了一个千行的页面,里面大概有七八个SUB/FUNCTION,调试的时候用了有三十几个response.write ,天,调试完后把这三十个一个个删除,累! </P>
6 |+ U$ p* R1 M8 s$ u0 l; N<>今天看到一个ASP中的Debug类(VBS),试用了一下,绝! 9 l% k2 `# g7 \- ~) ?8 o+ e
使用方法很简单: % }& T, H1 O" t$ Q8 g( T1 x
test.asp </P>
1 Z! P3 ~# u- E6 _& B<>&lt;!--#INCLUDE FILE="debuggingConsole.asp"--&gt;   n5 E% p& k1 m+ B' H8 }* K
&lt;%
9 u. v$ S8 W! P# x$ `2 }# Goutput="XXXX"
5 F& K  D: _' F( M  dSet debugstr = New debuggingConsole
) A4 K# A6 r' y, wdebugstr.Enabled = true . \) ^7 E) A: V& o- ~# A$ T9 u
   debugstr.Print "参数output的值", output ) `- @; `( _4 b  z$ T" ?
   '……
7 C" z2 t" }6 `# M1 s- t: A( e   debugstr.draw
# B% h* ^4 v  GSet debugstr = Nothing . @0 H) Q1 `1 u) w- c
%&gt; </P>
- q( j+ R2 k: o0 W<>=================================================== </P>
0 \& E0 u, F/ I( r2 V<>debuggingConsole.asp </P># K3 t. t0 i- v+ T' s! d9 Y) l
<>&lt;% , t* }: \: g5 y$ f+ ]" W1 J$ U, l9 V
Class debuggingConsole </P>5 j, @$ o2 B# l8 W- H% S
<>   private dbg_Enabled
. s4 _0 O+ Y! y3 E( g% B$ r   private dbg_Show 9 d  s3 N" P1 G1 w, e+ \5 L- W7 ^
   private dbg_RequestTime
2 ^9 m0 X0 }) @4 @) L. j* X& [: l   private dbg_FinishTime # N5 j) F9 S2 j9 V' t$ f
   private dbg_Data   O+ i! a; C: _# {. c4 B! A6 R) ]
   private dbg_DB_Data
0 q8 }- b0 Q$ e   private dbg_AllVars
4 P9 V, f4 F( k4 N0 G; {   private dbg_Show_default $ {  A" A3 g( d3 i. {3 Y
   private DivSets(2) 7 _6 G- E. E, L0 h( ~9 A$ E
   0 f8 e5 C1 C7 ^: f+ b* ?
'Construktor =&gt; set the default values
7 i5 B7 f2 T* OPrivate Sub Class_Initialize() $ P4 c. z. ]+ {2 J& l# F+ ~7 a; w
   dbg_RequestTime = Now() - f* ^4 o. D. a1 u8 `
   dbg_AllVars = false
5 t. ]  e, h+ w   Set dbg_Data = Server.CreateObject("Scripting.Dictionary") </P>
* X% o- {/ Y( B3 W7 w<>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>1 _% c3 y# ]( d$ ?5 F
<>   DivSets(1) = "&lt;TR&gt;&lt;TD&gt;
: k- P* c7 s6 t% h4 O+ T* g2 z7 j- 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>8 q, X, q  n, {  t
<>   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>: C. w: V3 o7 d6 H! }0 D  @
<>   dbg_Show_default = "0,0,0,0,0,0,0,0,0,0,0"
) b* l) B/ D: hEnd Sub </P>8 @; o3 t( d/ B/ E) B. y" f# Q
<>ublic Property Let Enabled(bNewValue) ''[bool] Sets "enabled" to true or false
6 E* c2 l/ E& |! \' W   dbg_Enabled = bNewValue 7 U( I* |$ d) z2 i9 A, E
End Property </P>( C0 ?7 C) y: B) F  z# n
<>ublic Property Get Enabled ''[bool] Gets the "enabled" value ) w4 i) n7 V8 E9 Q. S
   Enabled = dbg_Enabled
. S3 K4 g% I& v8 }8 M! |End Property </P>/ }& W0 t- C. M
<>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
7 k2 G, A8 B+ ^8 q  P# Q% A$ Z, c   dbg_Show = bNewValue
2 }* j9 H$ ?! `( C$ j) tEnd Property </P>
/ A" m, E5 w: Q6 w<>ublic Property Get Show ''[string] Gets the debugging panel. , n5 C7 O. U1 Y' V
   Show = dbg_Show
$ d# ?1 o% ^+ B, B- H- `End Property </P>
1 f# ?% z% o- J) o8 T, i/ N  h<>ublic Property Let AllVars(bNewValue) ''[bool] Sets wheather all variables will be displayed or not. true/false ; J: L2 y; S6 Z. z8 j7 l1 L/ P
   dbg_AllVars = bNewValue . f- O+ n" @2 J. K/ {
End Property </P>5 n3 a/ O+ k4 c" {- e7 B, }3 ~' ]+ u
<>ublic Property Get AllVars ''[bool] Gets if all variables will be displayed. 8 V) \# R3 {( [
   AllVars = dbg_AllVars ) W& R8 V) Q' ~
End Property </P>0 L' W+ t$ r' T7 q8 K( B
<>'***********************************************************
. Y9 W; ]- ]: F, \( J7 Q5 w: Q''@SDESCRIPTION: Adds a variable to the debug-informations. 1 r+ o9 I& C5 f$ g' [4 [1 Q
''@PARAM:  - label [string]: Description of the variable
3 i" J4 Y+ Y3 ]- J- u% o) y& M''@PARAM:  - output [variable]: The variable itself
- B) S* |+ g$ M8 B, T'*********************************************************** ' D; p  ^& V& G0 K( T/ y) v
Public Sub Print(label, output) ! A( e* r1 i# z+ S5 z
   If dbg_Enabled Then ! `5 `2 @6 @' k% q+ Q$ P9 b7 N8 O
     if err.number &gt; 0 then " U1 Q6 q5 d. G6 ^5 Z8 _5 |
       call dbg_Data.Add(ValidLabel(label), "!!! Error: " &amp; err.number &amp; " " &amp; err.Description)
8 T: {9 D  u3 @0 s4 `5 J       err.Clear
' o( Y& Q- {; u: A     else
4 Z3 i. P: q$ T! I& l8 T       uniqueID = ValidLabel(label) : g( s. x# _% n! J
       response.write uniqueID
" a: A3 z+ Y$ M! B! Y4 \* ?       call dbg_Data.Add(uniqueID, output)
, f( C" S" ]2 x/ |5 v7 E$ d     end if
- n7 p! o6 w1 k2 j: y   End If
7 Q6 k8 e# l" v" o1 |, p' @End Sub
( a, d* _" s3 s1 m& p' ^8 C  3 G% }  S+ K# G) e  z) h. W+ Q
'***********************************************************
' \, e9 c" r( h- l0 Y9 E  \! B'* ValidLabel 2 z. U  s8 F& C4 }4 `6 H7 T
'***********************************************************
/ c4 X2 n4 w3 JPrivate Function ValidLabel(byval label) ; l9 y4 g6 C; H7 T+ z/ r7 l
   dim i, lbl / Q9 w4 N- b; p  S
   i = 0
" y. e3 O8 X0 S) H   lbl = label 0 z8 m' }9 ?" v6 W; k. y4 \
   do
7 |2 q* P: l1 W1 W8 U( L8 k4 ~2 R   if not dbg_Data.Exists(lbl) then exit do
( x1 p, t  G$ T) U* \3 n   i = i + 1
2 W1 t3 o9 k0 N   lbl = label &amp; "(" &amp; i &amp; ")"
2 _1 N  ^4 K; l7 o   loop until i = i
# D0 L; d/ H. E/ `/ \6 L  
% @* V  N& K) z+ U5 m   ValidLabel = lbl   Z4 F* Z  f; l0 T8 u
End Function
2 S) E) Q$ Z9 F( m5 I( k, J  7 y) g$ y$ S. W4 i6 }
'***********************************************************
( a1 t6 W- a6 {6 B8 o) i" P'* PrintCookiesInfo " M  S8 o; Z3 T' N$ ~# A' |( p
'***********************************************************
' X2 T' l5 D! f! W( }Private Sub PrintCookiesInfo(byval DivSetNo) 2 j  n( f+ p& Q
   dim tbl, cookie, key, tmp
0 ?# F' x) ?/ t) B. K# @   For Each cookie in Request.Cookies $ |9 J: @  c2 I! O% p. v
   If Not Request.Cookies(cookie).HasKeys Then
2 P/ m* V: H( g% g3 b) b3 |0 v     tbl = AddRow(tbl, cookie, Request.Cookies(cookie))   
% _0 E" {. B! w5 `- q   Else
, F+ c9 x: n- m/ S     For Each key in Request.Cookies(cookie) 8 Y6 c( ]0 ^% q8 g8 e6 k
     tbl = AddRow(tbl, cookie &amp; "(" &amp; key &amp; ")", Request.
) O0 K2 l' \% [' e  qCookies(cookie)(key))   ; c9 C4 A4 W) v. ^; ]
   Next : a4 P; w2 J$ O" c# i6 ^7 g8 F4 ?
   End If ! z+ h$ c+ g' Z% U9 e' G
   Next </P>) V, L& V) P. C
<>   tbl = MakeTable(tbl) ( P  {2 H' G4 @9 K. G6 g+ Q
   if Request.Cookies.count &lt;= 0 then DivSetNo = 2
% w8 ?% e; K/ B! v5 c: F   tmp = replace(replace(replace(DivSets(DivSetNo),"#sectname#","COOKIES"),"#title#","COOKIES"),"#data#",tbl)
2 z9 R5 b9 n* W& b7 k   Response.Write replace(tmp,"|", vbcrlf) 4 u" a) T, n( u( J8 X4 s" x
end sub
7 [- x! M" v* B) ?, v2 E  7 x1 m9 B- I% T' k% C
'***********************************************************
7 E- Z! r* r  Z- x. A+ Z'* PrintSummaryInfo 8 w* o, R  B* O
'***********************************************************
0 \0 K9 {5 r  V. S9 v6 D/ ~: X) jPrivate Sub PrintSummaryInfo(byval DivSetNo) 2 U) d4 m" l0 k& ~+ h
   dim tmp, tbl ' F! h7 J0 q* z8 ^
   tbl = AddRow(tbl, "Time of Request",dbg_RequestTime)
! R$ a8 U" P. D% I. J   tbl = AddRow(tbl, "Elapsed Time",DateDiff("s", dbg_RequestTime, dbg_FinishTime) &amp; " seconds")
7 y, U3 ?: m; t+ X4 p+ V   tbl = AddRow(tbl, "Request Type",Request.ServerVariables("REQUEST_METHOD")) 7 d" s+ Q$ K0 [4 G4 D. K) v- U
   tbl = AddRow(tbl, "Status Code",Response.Status)
( c2 u/ y5 }5 b7 u' o1 z' Y   tbl = AddRow(tbl, "Script Engine",ScriptEngine &amp; " " &amp; ScriptEngineMajorVersion &amp; "." &amp; ScriptEngineMinorVersion &amp; "." &amp; ScriptEngineBuildVersion)
: H) x' C2 ~. X2 N( n# H9 p' ?   tbl = MakeTable(tbl)
9 D, E5 D/ S6 W1 ^   tmp = replace(replace(replace(DivSets(DivSetNo),"#sectname#","SUMMARY"),"#title#","SUMMARY INFO"),"#data#",tbl) ' ^! l; I$ t, g2 W8 e$ r
   Response.Write replace(tmp,"|", vbcrlf) & M0 r" _8 K9 [/ {: ^; n8 e
End Sub </P>
4 m/ m4 @/ O4 b% y<>'***********************************************************
( v1 w9 _8 j  E1 F. B" j''@SDESCRIPTION: Adds the Database-connection object to the debug-instance. To display Database-information
6 W# M. ]& ^- n- b''@PARAM:  - oSQLDB [object]: connection-object
, R" [1 n* _. H  ~, j'***********************************************************
1 A6 ?- l. j  a1 dPublic Sub GrabDatabaseInfo(byval oSQLDB)
, U$ T- q6 _. v! h   dbg_DB_Data = AddRow(dbg_DB_Data, "ADO Ver",oSQLDB.Version) $ M! x( z+ v3 g& b, C
   dbg_DB_Data = AddRow(dbg_DB_Data, "OLEDB Ver",oSQLDB.Properties("OLE DB Version")) 2 P& l% d9 X  c* w$ i- t
   dbg_DB_Data = AddRow</P>
zan
转播转播0 分享淘帖0 分享分享0 收藏收藏0 支持支持1 反对反对0 微信微信
韩冰        

823

主题

3

听众

4048

积分

我的地盘我做主

该用户从未签到

发帖功臣 元老勋章

(dbg_DB_Data, "DBMS",oSQLDB.Properties("DBMS Name") &amp; " Ver: " &amp; oSQLDB.Properties("DBMS Version"))
% F( E. j6 h! R$ B! D( m   dbg_DB_Data = AddRow(dbg_DB_Data, "rovider",oSQLDB.Properties("rovider Name") &amp; " Ver: " &amp; oSQLDB.Properties("rovider Version"))
1 Z2 _2 {8 y% N! ^, DEnd Sub <>'***********************************************************
! z* k) q0 k7 F" [2 u+ g# N  W'* PrintDatabaseInfo
7 E1 I0 F- t1 S' d'***********************************************************
9 [6 R$ J# f9 t! N; p. W. m0 vPrivate Sub PrintDatabaseInfo(byval DivSetNo) 2 A, `& R% o' k/ W% ]
   dim tbl
; u$ D  n1 V, j" W) l& C   tbl = MakeTable(dbg_DB_Data) . k5 Q% x' \' M" C8 e, @  T4 D9 Q  {
   tbl = replace(replace(replace(DivSets(DivSetNo),"#sectname#","DATABASE"),"#title#","DATABASE INFO"),"#data#",tbl)
7 T! O! I) r% u   Response.Write replace(tbl,"|", vbcrlf)   j6 N/ S+ L' t% m) O
End Sub </P><>'*********************************************************** 3 Y! W# }1 M4 J) h" P( Y
'* PrintCollection
7 A' T4 K$ [" G'*********************************************************** ) K; Q: g3 d" y8 d8 l$ C) N
Private Sub PrintCollection(Byval Name, ByVal Collection, ByVal DivSetNo, ByVal ExtraInfo) " i- H4 M9 T% c. s. Q6 v2 i
   Dim vItem, tbl, Temp
& L/ t% l3 Z; k   For Each vItem In Collection
/ S  o) l5 I( `% V) }     if isobject(Collection(vItem)) and Name &lt;&gt; "SERVER VARIABLES" and Name &lt;&gt; "QUERYSTRING" and Name &lt;&gt; "FORM" then
6 U& E8 p: @$ b3 i       tbl = AddRow(tbl, vItem, "{object}") 4 x) a! ^9 O8 [
     elseif isnull(Collection(vItem)) then
3 ^* J+ Q9 _# P  N       tbl = AddRow(tbl, vItem, "{null}") , p( F  `$ N5 a) v, _
     elseif isarray(Collection(vItem)) then
+ {" h' L6 K" Z6 P       tbl = AddRow(tbl, vItem, "{array}") . s6 h% N( u& m; B' l* {  F
     else
( U+ H% t* |1 G       if dbg_AllVars then
6 V4 n4 V/ N( I       tbl = AddRow(tbl, "&lt;nobr&gt;" &amp; vItem &amp; "&lt;/nobr&gt;", server.HTMLEncode(Collection(vItem)))
5 E) B4 S  a( W8 x" F0 I     elseif (Name = "SERVER VARIABLES" and vItem &lt;&gt; "ALL_HTTP" and vItem &lt;&gt; "ALL_RAW") or Name &lt;&gt; "SERVER VARIABLES" then
' z3 |$ P$ }; c  @; p' q6 b1 @       if Collection(vItem) &lt;&gt; "" then
3 x, T2 j# w2 f       tbl = AddRow(tbl, vItem, server.HTML7 v7 j7 d- A6 l$ A7 G; l; e- p
Encode(Collection(vItem))) ' &amp; " {" &amp; TypeName(Collection(vItem)) &amp; "}") + Q  Y  T/ J- D& K3 J% |5 p
       else % d3 _5 h! R9 x& V$ u
       tbl = AddRow(tbl, vItem, "...")
* C. ~1 F+ s# W9 H/ p       end if % W1 k' ~0 \2 R3 n! W0 D* E6 b
     end if
% T0 _& S4 ~0 g' ]   end if
; o5 l5 f1 ^. R1 _# K: H   Next
4 |) K$ A9 J! @! l9 j* s, S   if ExtraInfo &lt;&gt; "" then tbl = tbl &amp; "&lt;TR&gt;&lt;TD COLSPAN=2&gt;&lt;HR&gt;&lt;/TR&gt;" &amp; ExtraInfo
" y( n( ~+ ~; Y, z/ a   tbl = MakeTable(tbl) 2 L7 v& v+ ~+ p2 x
   if Collection.count &lt;= 0 then DivSetNo =2
2 e, n& l' Z3 p( V! K     tbl = replace(replace(DivSets(DivSetNo),"#title#",Name),"#data#",tbl) 7 }1 |( C' J3 ~. K! Q: ?) Z& ?& U
     tbl = replace(tbl,"#sectname#",replace(Name," ",""))
' b6 f1 T- }( j     Response.Write replace(tbl,"|", vbcrlf)
+ W, a$ j$ t# {7 Z, M) G* u! U4 REnd Sub ) t" r3 l* T3 j' b! J
  + s+ u9 w  b, X/ z% {
'***********************************************************
8 f! E: [! P0 x- r" ^7 j' ^'* AddRow
$ N0 b! m; a+ A! W2 t" n% z8 }'***********************************************************
$ d" F9 m& F) E  g& bPrivate Function AddRow(byval t, byval var, byval val) ' y! f/ ^2 X; }3 C+ y, i
   t = t &amp; "|&lt;TR valign=top&gt;|&lt;TD&gt;|" &amp; var &amp; "|&lt;TD&gt;= " &amp; val &amp; "|&lt;/TR&gt;"
- |5 l* e; e0 z; v   AddRow = t ! V# `  M! k3 K+ z/ k- p; \
End Function </P><>'*********************************************************** 9 t9 V: b! a5 W1 N7 @
'* MakeTable * w$ U, D" q% q
'*********************************************************** 5 N. L% G( H, b# X; t
Private Function MakeTable(byval tdata)
- n- K8 b3 e3 x) r# B5 f/ w   tdata = "|&lt;table border=0 style=""font-size:10pt;font-weight:normal;""&gt;" + tdata + "&lt;/Table&gt;|"
+ t  q5 b; M' o& g" M- K+ G   MakeTable = tdata
- |; e+ |5 h& e! f0 b0 JEnd Function </P><>'***********************************************************
0 T) i" [8 {, X& R''@SDESCRIPTION: Draws the Debug-panel
5 W5 x* i. k; M'*********************************************************** 0 {+ b6 b3 ]( i( ~' t
Public Sub draw() 1 F' h+ \; @& @* a) C1 u. I
   If dbg_Enabled Then - T$ v# ?- J% n/ G4 t
     dbg_FinishTime = Now()
% d/ h; d, L' |5 O. h, D2 }  : @) u# P& B/ v* n$ a" x( D  K
   Dim DivSet, x ) l9 i; d6 n# j$ [& j. u  `
   DivSet = split(dbg_Show_default,",")
1 r2 `" x* N* d0 D8 B# n     dbg_Show = split(dbg_Show,",")
0 H  ^9 W  M! c/ P5 O% D% T  
1 G3 L6 ~/ L0 V   For x = 0 to ubound(dbg_Show)
0 z  a% X: d) b$ p7 o8 h  ^     divSet(x) = dbg_Show(x) * d( m( H: i% a8 u
   Next : d( V3 n5 e+ G7 C
  
. ]; G6 i6 |. M9 P6 \  G$ t   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;"
9 }, O; D4 N' L" N. W   Call PrintSummaryInfo(divSet(0)) * u( [/ A6 @3 ~: l) T. x. \
     Call PrintCollection("VARIABLES", dbg_Data,divSet(1),"")
9 f9 u% A  k: a7 ^/ L. S0 ?& ^: ?    Call PrintCollection("QUERYSTRING", Request.QueryString(), divSet(2),"")
8 x7 \. i, A4 L    Call PrintCollection("FORM", Request.Form(),divSet(3),"")
& Z+ u9 ?6 b  q    Call PrintCookiesInfo(divSet(4))
) ]7 y* H) p3 E! v4 W  h5 [3 n    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)) * f& i7 b: p* ?: I" F* d
    Call PrintCollection("APPLICATION", Application.Contents(),divSet(6),"") 6 b& [( G8 K' v* _
    Call PrintCollection("SERVER VARIABLES", Request.ServerVariables(),divSet(7),AddRow("","Timeout",Server.ScriptTimeout))
$ \) v2 J3 B; _    Call PrintDatabaseInfo(divSet(8))
; q. U% X# _) R2 w& B9 o7 K+ r. x    Call PrintCollection("SESSION STATIC OBJECTS", Session.StaticObjects(),divSet(9),"") 5 S3 E' \* k' b) \
    Call PrintCollection("APPLICATION STATIC OBJECTS", Application.StaticObjects(),divSet(10),"")
0 R( S; P1 K3 X5 e: ]6 q    Response.Write "&lt;/Table&gt;" & h5 a: u# a' }! O! S5 p
   End If : c: P6 c4 [3 m9 c5 ?
End Sub </P><>'Destructor ( A- B) k4 N! \: _5 @7 v
Private Sub Class_Terminate() - R% A5 C/ [3 ^. I7 v8 E0 h
   Set dbg_Data = Nothing 6 g9 F, f5 F9 m$ N5 ^: q
End Sub </P><>End Class </P><>%&gt; </P><>类的说明: </P><># R" n( i1 H9 w- X
CLASS debuggingConsole 1 F% ~3 y+ a$ N: H) A, t. S
Version: 1.2 </P><>-------------------------------------------------------------------------------- </P><>ublic Properties </P><>roperty Let Enabled(bNewValue)===[bool] Sets "enabled" to true or false   Y4 n$ ~1 ^* _% P. U0 E/ x- e4 V
&amp;n$ r) B0 U! L. u1 _( W
bsp;
6 m. M6 S( K0 H; _0 N# n0 w- d7 ]Property Get Enabled===[bool] Gets the "enabled" value . \: A. M+ z5 ?" R3 j& }
  3 K5 a; s: D/ ~4 n% p! R, l4 Q
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. P* z  }( {' z" ]: q9 J4 R
  
- ]$ j. x) K: e1 w( CProperty Get Show===[string] Gets the debugging panel.
, G" A) d1 O4 z    B; I/ X" u2 b
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><>-------------------------------------------------------------------------------- 4 f, z: y9 z% s/ n$ T! k9 a
Public Methods </P><>public sub===Print (label, output)
- D7 C; F0 u% s; Y: ~1 J   Adds a variable to the debug-informations.  </P><>public sub===GrabDatabaseInfo (byval oSQLDB)
# I, h6 L5 t+ m/ Z6 s   Adds the Database-connection object to the debug-instance. To display Database-information  </P><>public sub===draw () + a7 p6 [3 o: f; }- a! t+ @: _4 P
   Draws the Debug-panel  </P><>--------------------------------------------------------------------------------
; X+ r' f5 m3 T, aMethods Detail ! `, Z! ^: Z2 f. D) O$ m
  
4 a) _" T+ k! M3 Ipublic sub===Print (label, output)
. t4 Y/ U% f; I/ Y/ nParameters:  
% J0 Q# _9 M, ^) \7 o6 v4 k1 D! C   - label [string]: Description of the variable ' {. y1 g( K* Y  P
   - output [variable]: The variable itself 7 ~1 }  Z+ Q- v! p& z% ?
  
" M7 ~& Q9 O* m# D! kpublic sub===GrabDatabaseInfo (byval oSQLDB)
- q, u5 k% d4 |! yParameters:  
. k0 N. ?0 N4 X1 R9 q1 Q   - oSQLDB [object]: connection-object</P>
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册地址

qq
收缩
  • 电话咨询

  • 04714969085
fastpost

关于我们| 联系我们| 诚征英才| 对外合作| 产品服务| QQ

手机版|Archiver| |繁體中文 手机客户端  

蒙公网安备 15010502000194号

Powered by Discuz! X2.5   © 2001-2013 数学建模网-数学中国 ( 蒙ICP备14002410号-3 蒙BBS备-0002号 )     论坛法律顾问:王兆丰

GMT+8, 2026-1-16 06:46 , Processed in 0.349607 second(s), 56 queries .

回顶部