mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 14:29:14 +02:00
* SQL in separate verbosity level
git-svn-id: trunk@28448 -
This commit is contained in:
parent
e21d31dc99
commit
fee1632b42
@ -81,7 +81,8 @@ TConfigOpt = (
|
|||||||
coComment,
|
coComment,
|
||||||
coTestSrcDir,
|
coTestSrcDir,
|
||||||
coRelSrcDir,
|
coRelSrcDir,
|
||||||
coVerbose
|
coVerbose,
|
||||||
|
coSQL
|
||||||
);
|
);
|
||||||
|
|
||||||
{ Additional options only for dbdigest.cfg file }
|
{ Additional options only for dbdigest.cfg file }
|
||||||
@ -115,7 +116,8 @@ ConfigStrings : Array [TConfigOpt] of string = (
|
|||||||
'comment',
|
'comment',
|
||||||
'testsrcdir',
|
'testsrcdir',
|
||||||
'relsrcdir',
|
'relsrcdir',
|
||||||
'verbose'
|
'verbose',
|
||||||
|
'sql'
|
||||||
);
|
);
|
||||||
|
|
||||||
ConfigOpts : Array[TConfigOpt] of char =(
|
ConfigOpts : Array[TConfigOpt] of char =(
|
||||||
@ -136,7 +138,8 @@ ConfigOpts : Array[TConfigOpt] of char =(
|
|||||||
'C', { coComment }
|
'C', { coComment }
|
||||||
'S', { coTestSrcDir }
|
'S', { coTestSrcDir }
|
||||||
'r', { coRelSrcDir }
|
'r', { coRelSrcDir }
|
||||||
'V' { coVerbose }
|
'V', { coVerbose }
|
||||||
|
'Q' { coSQL }
|
||||||
);
|
);
|
||||||
|
|
||||||
ConfigAddStrings : Array [TConfigAddOpt] of string = (
|
ConfigAddStrings : Array [TConfigAddOpt] of string = (
|
||||||
@ -215,6 +218,7 @@ begin
|
|||||||
coCPU : TestCPU:=Value;
|
coCPU : TestCPU:=Value;
|
||||||
coCategory : TestCategory:=Value;
|
coCategory : TestCategory:=Value;
|
||||||
coVersion : TestVersion:=Value;
|
coVersion : TestVersion:=Value;
|
||||||
|
coSQL : DoSQL:=True;
|
||||||
coDate :
|
coDate :
|
||||||
begin
|
begin
|
||||||
{ Formated like YYYYMMDDhhmm }
|
{ Formated like YYYYMMDDhhmm }
|
||||||
|
@ -67,7 +67,7 @@ Function ConnectToDatabase(DatabaseName,Host,User,Password,Port : String) : Bool
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
Result:=False;
|
Result:=False;
|
||||||
Verbose(V_DEBUG,'Connection params : '+DatabaseName+' '+Host+' '+User+' '+Password+' '+Port);
|
Verbose(V_SQL,'Connection params : '+DatabaseName+' '+Host+' '+User+' '+Port);
|
||||||
Connection:=TPQConnection.Create(Nil);
|
Connection:=TPQConnection.Create(Nil);
|
||||||
try
|
try
|
||||||
Connection.Hostname:=Host;
|
Connection.Hostname:=Host;
|
||||||
@ -107,7 +107,7 @@ end;
|
|||||||
Function ExecuteQuery (Qry : String; Silent : Boolean) : Boolean ;
|
Function ExecuteQuery (Qry : String; Silent : Boolean) : Boolean ;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Verbose(V_DEBUG,'Executing query:'+Qry);
|
Verbose(V_SQL,'Executing query:'+Qry);
|
||||||
Result:=False;
|
Result:=False;
|
||||||
try
|
try
|
||||||
With CreateQuery(Qry) do
|
With CreateQuery(Qry) do
|
||||||
@ -132,7 +132,7 @@ Function OpenQuery (Qry : String; Out res : TSQLQuery; Silent : Boolean) : Boole
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
Result:=False;
|
Result:=False;
|
||||||
Verbose(V_DEBUG,'Running query:'+Qry);
|
Verbose(V_SQL,'Running query:'+Qry);
|
||||||
Res:=CreateQuery(Qry);
|
Res:=CreateQuery(Qry);
|
||||||
try
|
try
|
||||||
Res.Open;
|
Res.Open;
|
||||||
@ -156,7 +156,7 @@ begin
|
|||||||
Result:=''
|
Result:=''
|
||||||
else
|
else
|
||||||
Result:=Res.Fields[ID].AsString;
|
Result:=Res.Fields[ID].AsString;
|
||||||
Verbose(V_DEBUG,'Field value '+Result);
|
Verbose(V_SQL,'Field value '+Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure FreeQueryResult(var Res : TSQLQuery);
|
Procedure FreeQueryResult(var Res : TSQLQuery);
|
||||||
@ -202,7 +202,7 @@ Function EscapeSQL( S : String) : String;
|
|||||||
begin
|
begin
|
||||||
// Result:=StringReplace(S,'\','\\',[rfReplaceAll]);
|
// Result:=StringReplace(S,'\','\\',[rfReplaceAll]);
|
||||||
Result:=StringReplace(Result,'''','''''',[rfReplaceAll]);
|
Result:=StringReplace(Result,'''','''''',[rfReplaceAll]);
|
||||||
Verbose(V_DEBUG,'EscapeSQL : "'+S+'" -> "'+Result+'"');
|
Verbose(V_SQL,'EscapeSQL : "'+S+'" -> "'+Result+'"');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -341,7 +341,7 @@ begin
|
|||||||
FileName := FileName + '.pp'
|
FileName := FileName + '.pp'
|
||||||
else exit;
|
else exit;
|
||||||
|
|
||||||
Verbose(V_Debug,'Reading '+FileName);
|
Verbose(V_Debug,'Reading: '+FileName);
|
||||||
assign(t,FileName);
|
assign(t,FileName);
|
||||||
{$I-}
|
{$I-}
|
||||||
reset(t);
|
reset(t);
|
||||||
|
@ -10,7 +10,7 @@ Interface
|
|||||||
---------------------------------------------------------------------}
|
---------------------------------------------------------------------}
|
||||||
|
|
||||||
type
|
type
|
||||||
TVerboseLevel=(V_Abort,V_Error,V_Warning,V_Normal,V_Debug);
|
TVerboseLevel=(V_Abort,V_Error,V_Warning,V_Normal,V_Debug,V_SQL);
|
||||||
|
|
||||||
TConfig = record
|
TConfig = record
|
||||||
NeedOptions,
|
NeedOptions,
|
||||||
@ -48,6 +48,7 @@ type
|
|||||||
|
|
||||||
Const
|
Const
|
||||||
DoVerbose : boolean = false;
|
DoVerbose : boolean = false;
|
||||||
|
DoSQL : boolean = false;
|
||||||
|
|
||||||
procedure TrimB(var s:string);
|
procedure TrimB(var s:string);
|
||||||
procedure TrimE(var s:string);
|
procedure TrimE(var s:string);
|
||||||
@ -66,6 +67,9 @@ begin
|
|||||||
V_Debug :
|
V_Debug :
|
||||||
if DoVerbose then
|
if DoVerbose then
|
||||||
writeln('Debug: ',s);
|
writeln('Debug: ',s);
|
||||||
|
V_SQL :
|
||||||
|
if DoSQL then
|
||||||
|
writeln('SQL: ',s);
|
||||||
V_Warning :
|
V_Warning :
|
||||||
writeln('Warning: ',s);
|
writeln('Warning: ',s);
|
||||||
V_Error :
|
V_Error :
|
||||||
|
Loading…
Reference in New Issue
Block a user