unit DBAccess;
interface
uses
SqlExpr, SqlConst, DBXpress, DB, Math, SysUtils,
Utilities, StrUtils;
function MySQLFeedback(SQ:TSQLConnection;
Vorname, Name, Email, Title,
Version, Itemindex,
Kommentar, IP, Country :String ):boolean ;
procedure SQBeforeConnect(SQ:TSQLConnection;Passw:String ;Crypt:String );
implementation
function MySQLFeedback(SQ:TSQLConnection;
Vorname, Name, Email, Title,
Version, Itemindex,
Kommentar, IP, Country :String ):boolean ;
var
SQLstmt: Ansistring;
stmtParams: TParams;
CC:SQLResult;
Res:boolean ;
begin
stmtParams := TParams.Create;
SQLstmt := 'insert into feedbacks.feedback '
+ ' (Datum, Vorname, Name, Email, Produkt, '
+ ' Version, Bewertung, Kommentar, IP, Country) '
+ ' values( CURRENT_TIMESTAMP '
+ ' ,"' +Vorname+'" '
+ ' ,"' +Name+'" '
+ ' ,"' +Email+'" '
+ ' ,"' +Title+'" '
+ ' ,"' +Version+'" '
+ ' ,' +ItemIndex+' '
+ ' ,"' +Kommentar+'" '
+ ' ,"' +IP+'"'
+ ' ,"' +Country+'")' ;
;
try
Res := False;
SQ.LoadParamsOnConnect := True;
SQ.LoginPrompt := True;
SQ.Connected := True;
CC:=SQ.Execute(SQLstmt,stmtparams,nil );
if CC = 0 then //OK
Res:=true
else if CC = 1 then // Warnung ?
Res:=true
else
Res:=false
finally
stmtParams.Free;
end ;
MySQLFeedback:=Res
end ;
// set SQL connection
procedure SQBeforeConnect(SQ:TSQLConnection;Passw:String ;Crypt:String );
Var User:String ;
begin
with SQ do begin
Params.Values['BlobSize' ] := '-1' ;
Params.Values['Database' ] := 'feedbacks' ;
Params.Values['DriverName' ] := 'MYSQL' ;
Params.Values['ErrorResourceFile' ] := '' ;
Params.Values['HostName' ] := 'www.cococo.de' ;
Params.Values['LocaleCode' ] := '0000' ;
Params.Values['Password' ] := Passw;
User := LowerCase(Crypt);
Params.Values['User_Name' ] := User;
SQ.ParamsLoaded := true;
end
end ;
end .
quality 93%
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet)
¤
*© Formatika GbR, Deutschland