1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| try
FConnexion := mysql_init(nil);
except
raise Exception.Create(0, 'Librarie MySQL non Installée !');
end;
if not Assigned(FConnexion) then
begin
raise Exception.CreateFmt('Connexion non Initialisée : %d - %s ', [mysql_errno(FConnexion), mysql_error(FConnexion)]);
end;
if mysql_options(FConnexion, MYSQL_OPT_CONNECT_TIMEOUT, PChar(FTimeOut)) <> 0 then
begin
raise Exception.CreateFmt('TimeOut non Initialisé : %d - %s ', [mysql_errno(FConnexion), mysql_error(FConnexion)]);
end;
if not Assigned(mysql_real_connect(FConnexion, PChar(FServerName), PChar(FLogin), PChar(FPW), PChar(FDataBaseName), 0, nil, 0)) then
begin
raise Exception.CreateFmt('Echec de la Connexion : %d - %s ', [mysql_errno(FConnexion), mysql_error(FConnexion)]);
end; |
Partager