2
$Id: mtest.pp,v 1.1.2.1 2000/09/01 22:19:12 peter Exp $
3
This file is part of the Free Pascal run time library.
4
Copyright (c) 1999-2000 by the Free Pascal development team
8
See the file COPYING.FPC, included in this distribution,
9
for details about the copyright.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
**********************************************************************}
18
uses db,sysutils,mysqldb;
20
Procedure Log(Const Msg : String);
25
Procedure DumpFieldDef(F : TfieldDef);
30
Writeln ('Name : ',Name);
31
Writeln ('FieldNo : ',FieldNo);
32
Writeln ('Size : ',Size);
33
Writeln ('FieldClass : ',FieldClass.ClassName);
34
Writeln ('Required : ',required);
35
Writeln ('Precision : ',Precision);
36
Writeln ('DataType : ',FieldTypeNames[DataType]);
37
Writeln ('InternalCalcField : ',Internalcalcfield);
41
Procedure DumpField(F : Tfield);
46
Writeln ('FieldName : ',FieldName);
47
Writeln ('FieldNo : ',FieldNo);
48
Writeln ('Index : ',Index);
49
Writeln ('DataSize : ',DataSize);
50
Writeln ('Size : ',Size);
51
Writeln ('DataType : ',FieldTypeNames[DataType]);
52
Writeln ('Class : ',ClassName);
53
Writeln ('Required : ',required);
54
Writeln ('ReadOnly : ',ReadOnly);
55
Writeln ('Visible : ',Visible);
59
Procedure DumpFieldData (F : TField);
64
Writeln ('Field : ',FieldName);
65
Writeln ('Data type : ',FieldTypeNames[DataType]);
66
Writeln ('As String : ',Asstring);
68
ftSmallint, ftInteger, ftWord : Writeln ('As longint : ',AsLongint);
69
ftBoolean : Writeln ('As Boolean : ',AsBoolean);
70
ftFloat : Writeln ('As Float : ',AsFloat);
71
ftDate, ftTime, ftDateTime : Writeln ('As DateTime : ',DateTimeToStr(AsDateTime));
79
Bookie : TBookMarkStr;
81
Procedure ScrollForward;
84
Writeln ('Browsing Forward:');
85
Writeln ('------------------');
89
For I:=0 to FieldCount-1 do
90
DumpFieldData(Fields[I]);
95
Procedure ScrollBackWard;
98
Writeln ('Browsing Backward:');
99
Writeln ('-------------------');
103
For I:=0 to FieldCount-1 do
104
DumpFieldData(Fields[I]);
110
if paramcount<>4 then
112
Writeln ('Usage : mtest db user pwd sql');
115
Log ('Creating Dataset');
116
Data:=TMysqlDataset.Create(Nil);
119
Log('Setting database');
120
Database:=Paramstr(1);
123
Log('Setting password');
124
PassWord := Paramstr(3);
126
SQL.text := Paramstr(4);
127
Log('Opening Dataset');
129
Log('Dumping fielddefs : ');
130
Writeln ('Fielddefs count : ',FieldDefs.Count);
131
For I:=0 to FieldDefs.Count-1 do
132
DumpFieldDef(FieldDefs.Items[i]);
133
Writeln ('Fields count : ',FieldCount);
134
For I:=0 to FieldCount-1 do
135
DumpField(Fields[i]);
138
Writeln ('Going to last :');
139
writeln ('---------------');
143
Writeln ('Going to first:');
146
Writeln ('Browsing Forward:');
147
Writeln ('------------------');
152
If Count=recordCount div 2 then
154
Writeln ('Setting bookmark on record');
156
Writeln ('Got data : "',Bookie,'"');
158
For I:=0 to FieldCount-1 do
159
DumpFieldData(Fields[I]);
162
Writeln ('Jumping to bookmark',Bookie);
164
Writeln ('Dumping Record : ');
165
For I:=0 to FieldCount-1 do
166
DumpFieldData(Fields[I]);
168
Writeln ('Dumping Next Record : ');
169
For I:=0 to FieldCount-1 do
170
DumpFieldData(Fields[I]);
173
Writeln ('Dumping Previous Record : ');
174
For I:=0 to FieldCount-1 do
175
DumpFieldData(Fields[I]);
176
Log('Closing Dataset');
185
Revision 1.1.2.1 2000/09/01 22:19:12 peter
188
Revision 1.1 2000/07/13 06:31:27 michael
191
Revision 1.5 2000/01/07 01:24:32 peter
192
* updated copyright to 2000
194
Revision 1.4 2000/01/06 01:20:32 peter
195
* moved out of packages/ back to topdir
197
Revision 1.1 2000/01/03 19:33:06 peter
198
* moved to packages dir
200
Revision 1.2 1999/10/24 17:07:54 michael
201
+ Added copyright header
b'\\ No newline at end of file'