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