Database and some TDB class? lazarus / 16-Databases ---------------------------------------------------------------------- osddeitf · 2015-06-18 09:17 Hi everyone, i see some TDB classes in Data Controls. i tried to put TDBImage to my form then i see some property of TImage and some else property like DataField, DataSource and WriteHeader. i guess TDBImage and other TDB classes have been created to programming special application. after all, i want to know what is database and what difference of TDBEdit and TEdit, TDBImage and TImage, how they work and some ideas or types of application that need to use them? ---------------------------------------------------------------------- taazz · 2015-06-18 09:33 Quote from: osddeitf on June 18, 2015, 11:17:15 ami guess TDBImage and other TDB classes have been created to programming special application. Nothing special really, in one hand you have a control that is designed for a specific reason eg tedit to edit text TImage to view pictures etc with out any persisting capabilities built in so in order to save the changes you need to write your own code. On the other hand you have the same controls that are extended to persist the changes to a database and a framework that allows you to target different databases with the same DB aware controls. Quote from: osddeitf on June 18, 2015, 11:17:15 amafter all, i want to know what is database and Well a database is a library that allows you to save data in various formats and sizes, define rules of validity and enforce them on your data. There are a number of technologies involved from a data container to a tcp server in various blends and complexities. From a simple data container whith out any notion of data at all eg the CSV file format to the more elaborate RDBMS packages like postgreSQL, MSSQL server, oracle etc. All in all any library that allows you to define a data schema and fill it with data can be considered a database. ---------------------------------------------------------------------- osddeitf · 2015-06-18 11:04 Quote from: taazz on June 18, 2015, 11:33:25 amQuote from: osddeitf on June 18, 2015, 11:17:15 ami guess TDBImage and other TDB classes have been created to programming special application. Nothing special really, in one hand you have a control that is designed for a specific reason eg tedit to edit text TImage to view pictures etc with out any persisting capabilities built in so in order to save the changes you need to write your own code. On the other hand you have the same controls that are extended to persist the changes to a database and a framework that allows you to target different databases with the same DB aware controls. Quote from: osddeitf on June 18, 2015, 11:17:15 amafter all, i want to know what is database and Well a database is a library that allows you to save data in various formats and sizes, define rules of validity and enforce them on your data. There are a number of technologies involved from a data container to a tcp server in various blends and complexities. From a simple data container whith out any notion of data at all eg the CSV file format to the more elaborate RDBMS packages like postgreSQL, MSSQL server, oracle etc. All in all any library that allows you to define a data schema and fill it with data can be considered a database. Yeah, that simple mean it's a usefully control to store the data in some where with custom encryption and load it like a save data while open the app again, right? What's the database controls that you think simplest or easiest to start programming with it? Get me one, taazz ---------------------------------------------------------------------- jma_sp · 2015-06-18 11:45 You can begin with: C:\lazarus\examples\database\image_mushrooms And copy library sqlite3.dll into this same directory. Also you can see this: http://www.firebirdsql.org http://www.firebirdnews.org/docs/fb2min.html http://sourceforge.net/projects/firebird/?source=directory http://sourceforge.net/projects/flamerobin/?source=directory ---------------------------------------------------------------------- taazz · 2015-06-18 12:00 Quote from: osddeitf on June 18, 2015, 01:04:39 pmYeah, that simple mean it's a usefully control to store the data in some where with custom encryption and load it like a save data while open the app again, right? Yes that is what persistent means. The changes persist between computer restarts. As for the custom encryption that is part of the database framework not the editor. Quote from: osddeitf on June 18, 2015, 01:04:39 pmWhat's the database controls that you think simplest or easiest to start programming with it? Start with TDBEdit connected to any field of a tDataset/Tdatasource and ask here when tdbedit fails on some data type. ---------------------------------------------------------------------- Graeme · 2015-06-22 11:45 Just thought I would add a note here.. You don't only need to use TDBxxx components to display database information in an application. I personally hate those components because with every TDataset you drop on a form you tie your application more and more to a specific table structure. The TDBxxx components are also pretty much a duplication of the non-db aware components, and just another place where bugs could creep in. For that reason alternatives exist. For example, I implemented the Model-GUI-Mediator (MGM) design pattern inside the opens source tiOPF project. This was done many years back, and that code still servers me and others today.  MGM allows any standard non-DB components to become "object aware". No new custom components are introduced, and because the MGM implementation is 99% non-gui code, it is also very well unit tested.  MGM uses the power of the Observer design pattern to update GUI components as soon as properties of an Object changes - the reverse is done too. The Object in memory could be a simple object or a object that represents a database record. All non-db components are supported. TEdit, TComboBox, etc. Even more complex componest like TTreeView, TStringGrid, TListView are supported. My MGM implementation also supports 3 gui toolkits: LCL, VCL and fpGUI.