var
Form1: TForm1;
_myCon: PMYSQL;
host, user, pass,
db: PChar;
ErrorCode: Integer;
MySQLRes: PMYSQL_RES;
MySQLRow: PMYSQL_ROW;
AffectedRows: Int64;
Field: PMYSQL_FIELD;
//...
procedure connect;
var Datei: TextFile;
MyString: Ansistring;
begin
AssignFile(Datei, ExtractFilePath(Application.ExeName) + '
SQL.set');
Reset(Datei);
try
ReadLn(Datei, MyString);
host := PChar(copy(MyString, pos('
:', MyString)+1, length(MyString)));
ReadLn(Datei, MyString);
User := PChar(copy(MyString, pos('
:', MyString)+1, length(MyString)));
ReadLn(Datei, MyString);
Pass := PChar(copy(MyString, pos('
:', MyString)+1, length(MyString)));
ReadLn(Datei, MyString);
DB := PChar(copy(MyString, pos('
:', MyString)+1, length(MyString)));
finally
CloseFile(Datei);
end;
end;
{73} _myCon := mysql_init(
nil);
if _mycon=nil
then
begin
showmessage('
Nicht genügend freier Speicher!');
{78} Exit;
end;
{80} if mysql_real_connect(_mycon, host, user, pass,
db, 3306,
nil,0)=nil
then
begin
showmessage('
Die Verbindung konnte nicht hergestellt werden! Ursache:' + mysql_error(_mycon));
exit;
{83} end;
end;