6
DataBase : Pchar = 'testdb';
7
Query : Pchar = 'Select * from FPdev';
22
Dummy:=Paramstr(1)+#0;
25
Write ('Connecting to MySQL...');
26
sock := mysql_connect(PMysql(@qmysql),nil,nil,nil);
29
Writeln (stderr,'Couldn''t connect to MySQL.');
30
Writeln (stderr,mysql_error(@qmysql));
34
Writeln ('Connection data:');
36
writeln ('Mysql_port : ',mysql_port);
37
writeln ('Mysql_unix_port : ',mysql_unix_port);
39
writeln ('Host info : ',mysql_get_host_info(sock));
40
writeln ('Server info : ',mysql_stat(sock));
41
writeln ('Client info : ',mysql_get_client_info);
43
Writeln ('Selecting Database ',DataBase,'...');
44
if mysql_select_db(sock,DataBase) < 0 then
46
Writeln (stderr,'Couldn''t select database ',Database);
47
Writeln (stderr,mysql_error(sock));
51
writeln ('Executing query : ',Query,'...');
52
if (mysql_query(sock,Query) < 0) then
54
Writeln (stderr,'Query failed ');
55
writeln (stderr,mysql_error(sock));
59
recbuf := mysql_store_result(sock);
62
Writeln ('Query returned nil result.');
66
Writeln ('Number of records returned : ',mysql_num_rows (recbuf));
67
Writeln ('Number of fields per record : ',mysql_num_fields(recbuf));
69
rowbuf := mysql_fetch_row(recbuf);
70
while (rowbuf <>nil) do
72
Write ('(Id: ', rowbuf[0]);
73
Write (', Name: ', rowbuf[1]);
74
Writeln(', Email : ', rowbuf[2],')');
75
rowbuf := mysql_fetch_row(recbuf);
77
Writeln ('Freeing memory occupied by result set...');
78
mysql_free_result (recbuf);
80
Writeln ('Closing connection with MySQL.');
85
Revision 1.3 2002/09/07 15:42:53 peter
86
* old logs removed and tabs fixed
88
Revision 1.2 2002/05/31 11:54:33 marco
89
* Renamefest for 1.0, many 1.1.x spots patched also.
91
Revision 1.1 2002/01/29 17:54:54 peter
92
* splitted to base and extra