Sign in Join
Wiki copytemporary

Database bug reporting: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
1+---
2+[[Portal:Databases|**Databases portal**]]
3+References:
4+
5+ * [[Databases|General info]]
6+ * [[Database libraries|Libraries]]
7+ * [[Database field type|Field types]]
8+ * [[Data Controls tab|Controls]]
9+ * [[Lazarus DB Faq|FAQ]]
10+ * [[SqlDBHowto|SQL how-to]]
11+ * [[Working With TSQLQuery]]
12+ * [[How to write in-memory database applications in Lazarus/FPC|In-memory database applications]]
13+
14+Tutorials/practical articles:
15+
16+ * [[Lazarus Database Overview|Overview]]
17+ * [[SQLdb Tutorial0|0 - Database set-up]]
18+ * [[SQLdb Tutorial1|1 - Getting started]]
19+ * [[SQLdb Tutorial2|2 - Editing]]
20+ * [[SQLdb Tutorial3|3 - Queries]]
21+ * [[SQLdb Tutorial4|4 - Data modules]]
22+ * [[SQLdb Programming Reference]]
23+
24+Databases
25+
26+ [[Advantage Database Server|Advantage]] \- [[MySQLDatabases|MySQL]] \- [[mssqlconn|MSSQL]] \- [[postgres|Postgres]] \- [[Firebird|Interbase]] \- [[Firebird]] \- [[Oracle]] \- [[ODBCConn|ODBC]] \- [[TParadox|Paradox]] \- [[SQLite]] \- [[Lazarus Tdbf Tutorial|dBASE]] \- [[MS Access]] \- [[Zeos tutorial|Zeos]]
27+
28+## Contents
29+
30+ * 1 Sorts of bugs
31+ * 2 Reporting bugs
32+ * 3 Bug reporting template
33+ * 3.1 Lazarus
34+ * 3.2 Free Pascal
35+ * 4 See also
36+
137## Sorts of bugs
238
3-Bugs regarding databases can lie in three areas:
39+Bugs regarding databases can lie in three areas:
440
5-- The GUI controls in Lazarus (DBGrid etc)
6-- The FPC database code (T*Connection, T*Query etc)
7-- The underlying infrastructure: database drivers/dlls, operating system, network, database server
41+ * The GUI controls in Lazarus (DBGrid etc)
42+ * The FPC database code (T*Connection, T*Query etc)
43+ * The underlying infrastructure: database drivers/dlls, operating system, network, database server
844
9-Lazarus builds on the FPC code, which builds on the infrastructure, so problems that show up in Lazarus GUI programs can be caused by bugs from any category.
45+Lazarus builds on the FPC code, which builds on the infrastructure, so problems that show up in Lazarus GUI programs can be caused by bugs from any category.
1046
1147## Reporting bugs
1248
13-When reporting bugs, it is very useful (and often essential) to have a compilable test program that shows the problem. See [[Tips on writing bug reports]] for reasons why.
49+When reporting bugs, it is very useful (and often essential) to have a compilable test program that shows the problem. See [[Tips on writing bug reports]] for reasons why.
1450
15-In case of database bugs, that means that you need to show how to create a database as well so others can repeat the test.
51+In case of database bugs, that means that you need to show how to create a database as well so others can repeat the test.
1652
17-To make this easier, you can write your bug report for common test/demonstration databases such as:
53+To make this easier, you can write your bug report for common test/demonstration databases such as:
1854
19-- Firebird's employee.fdb
20-- Microsoft SQL Server's AdventureWorks
55+ * Firebird's employee.fdb
56+ * Microsoft SQL Server's AdventureWorks
2157
22-If you don't, please add the DDL (the schema definition) and sample data SQL INSERT statements (or code that performs this).
58+If you don't, please add the DDL (the schema definition) and sample data SQL INSERT statements (or code that performs this).
2359
2460## Bug reporting template
2561
26-It's annoying to have to write long test programs when you just want to report a bug. However, it's also annoying and time-consuming for developers to have to write a program just to test if behaviour is incorrect.
62+It's annoying to have to write long test programs when you just want to report a bug. However, it's also annoying and time-consuming for developers to have to write a program just to test if behaviour is incorrect.
2763
28-A possible solution: use a template program and adapt that to your bug.
64+A possible solution: use a template program and adapt that to your bug.
2965
3066### Lazarus
3167
32-For Lazarus, you can use one of the demo database applications in your examples directory (e.g. examples\database\sqldbtutorial3) and adapt that. Don't forget to specify how to create the required database (include the needed CREATE TABLE etc SQL) - or specify a well-known sample database as mentioned above.
68+For Lazarus, you can use one of the demo database applications in your examples directory (e.g. examples\database\sqldbtutorial3) and adapt that. Don't forget to specify how to create the required database (include the needed CREATE TABLE etc SQL) - or specify a well-known sample database as mentioned above.
3369
3470### Free Pascal
3571
36-A template program can be found below. Please adjust where marked. Once you've tested the program in your own environment, **don't forget to remove confidential passwords** etc.
37-
38-``` pascal
72+A template program can be found below. Please adjust where marked. Once you've tested the program in your own environment, **don't forget to remove confidential passwords** etc.
73+```
3974program dberror;
40-
41-{$mode objfpc}{$H+}
42-
43-uses
44- {$IFDEF UNIX}{$IFDEF UseCThreads}
45- cthreads,
46- {$ENDIF}{$ENDIF}
47- Classes, sysutils,
48- sqldb,
49- ibconnection {*REPLACE WITH RELEVANT CONNECTION LIBRARY*};
50-
51-{
52-* ADD THE SQL NEEDED TO CREATE THE DATABASE HERE *
53-also known as the DDL/schema for the database.
54-For Firebird you can just say to use the Employee sample database.
55-For MSSQL you can just say to use the Adventureworks sample database.
56-}
57-
58-var
59- Conn: TibConnection; {*REPLACE WITH RELEVANT CONNECTION *}
60- Tran: TSQLTransaction;
61- Q: TSQLQuery;
62-begin
63- Conn:=TIBConnection.create(nil); {*REPLACE WITH RELEVANT CONNECTION *}
64- Tran:=TSQLTransaction.create(nil);
65- Q:=TSQLQuery.Create(nil);
66- try
67- // *REMOVE IDENTIFYING INFO AND EDIT AS NEEDED*
68- Conn.HostName:='127.0.0.1';
69- Conn.UserName:='SYSDBA';
70- Conn.Password:='masterkey';
71- Conn.DatabaseName:='employee';
72- // *END IDENTIFIYING INFO*
73- Conn.Transaction:=Tran;
74- Q.DataBase:=Conn;
75- Conn.Open;
76- // *EXAMPLE BUG TESTING CODE, REPLACE WITH YOUR OWN*
77- Q.SQL.Text:='select now() as RightNow ';
78- Q.Open;
79- Q.Last; //force recordcount update
80- writeln('recordcount: '+inttostr(q.RecordCount));
81- Q.Close;
82- // *END EXAMPLE BUG TESTING CODE*
83- Conn.Close;
84- finally
85- Q.Free;
86- Tran.Free;
87- Conn.Free;
88- end;
89- writeln('Program complete. Press a key to continue.');
90- readln;
91-end.
75+
76+ {$mode objfpc}{$H+}
77+
78+ uses
79+ {$IFDEF UNIX}{$IFDEF UseCThreads}
80+ cthreads,
81+ {$ENDIF}{$ENDIF}
82+ Classes, sysutils,
83+ sqldb,
84+ ibconnection {*REPLACE WITH RELEVANT CONNECTION LIBRARY*};
85+
86+ {
87+ * ADD THE SQL NEEDED TO CREATE THE DATABASE HERE *
88+ also known as the DDL/schema for the database.
89+ For Firebird you can just say to use the Employee sample database.
90+ For MSSQL you can just say to use the Adventureworks sample database.
91+ }
92+
93+ var
94+ Conn: TibConnection; {*REPLACE WITH RELEVANT CONNECTION *}
95+ Tran: TSQLTransaction;
96+ Q: TSQLQuery;
97+ begin
98+ Conn:=TIBConnection.create(nil); {*REPLACE WITH RELEVANT CONNECTION *}
99+ Tran:=TSQLTransaction.create(nil);
100+ Q:=TSQLQuery.Create(nil);
101+ try
102+ // *REMOVE IDENTIFYING INFO AND EDIT AS NEEDED*
103+ Conn.HostName:='127.0.0.1';
104+ Conn.UserName:='SYSDBA';
105+ Conn.Password:='masterkey';
106+ Conn.DatabaseName:='employee';
107+ // *END IDENTIFIYING INFO*
108+ Conn.Transaction:=Tran;
109+ Q.DataBase:=Conn;
110+ Conn.Open;
111+ // *EXAMPLE BUG TESTING CODE, REPLACE WITH YOUR OWN*
112+ Q.SQL.Text:='select now() as RightNow ';
113+ Q.Open;
114+ Q.Last; //force recordcount update
115+ writeln('recordcount: '+inttostr(q.RecordCount));
116+ Q.Close;
117+ // *END EXAMPLE BUG TESTING CODE*
118+ Conn.Close;
119+ finally
120+ Q.Free;
121+ Tran.Free;
122+ Conn.Free;
123+ end;
124+ writeln('Program complete. Press a key to continue.');
125+ readln;
126+ end.
92127```
93128
94-Of course, if you don't want to use this template but want to directly write a test case for the [[Databases|db test framework]], that's very welcome.
129+Of course, if you don't want to use this template but want to directly write a test case for the [[Databases|db test framework]], that's very welcome.
95130
96131## See also
97132
98-- [[How do I create a bug report]] General information on how to report a bug for Lazarus/FPC
99-- [[Tips on writing bug reports]] Explains e.g. why test programs in bug reports are so important
133+ * [[How do I create a bug report]] General information on how to report a bug for Lazarus/FPC
134+ * [[Tips on writing bug reports]] Explains e.g. why test programs in bug reports are so important
100135
101136---
102-*From the Free Pascal wiki, page "Database bug reporting", as it stood on 2020-09-16 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
103-Category: Databases
104-Category: Lazarus
105-Category: Troubleshooting
137+*From the Free Pascal wiki, page "Database bug reporting", as the Internet Archive kept it on 2023-08-02. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history