Logo
Development of Delphi components and applications   

DB Version Update - help and example of using

Step 1 - How to generate update project

  • run EditMDBUpdate.exe application
    dbrunedit
  • create new project, select old and new version of DB files
  • if you want to check database version before updating (recommended), use one simple table inside your database to save version value, e.g.
    dbvertbl
    and enter SQL commands for reading and updating of version value
    e.g. reading value: SELECT Version FROM Version
    e.g. updating value: UPDATE Version SET Version='1.1'
  • run comparison of database, result is list of tables, fields and indexes changes
    dbrunedit2
  • detected changes can be modified manually (usually only renaming of fields should be corrected, because renamed field is detected as oldone field to remove and newone field to add)
  • DB Update tool updates only structure of tables, so if some data manipulations is needed (adding new records, modifying or deleting of records), SQL commands can be used, e.g. UPDATE Firms SET City = "New York" WHERE (Adr_City="NY");
  • set update properties and create output files (2 files will be created: *.info and *.model)
    dbrunedit3

Step 2a - How to update database using standalone application

  • distribute created *.info and *.model files together with standalone update application RunMDBUpdate.exe
  • user can run update application manually or can be started directly from your application
    dbrunupdate1
  • for starting from application you can use parameters as follows:
    RunMDBUpdate.exe projectname.info or RunMDBUpdate.exe projectname.info /autorun for auto update without user confirmation
  • important notice: updated database must be closed in your application before running RunMDBUpdate.exe, in other case update fails

Step 2b - How to update database using DLL library

  • distribute created *.info and *.model files together with library MDBUpdate.dll
  • in your application load this library and use function:
    function RunMDBUpdate(ProjectFile,UpdateFile: PChar; UpdCallBack: TUpdCallBack): boolean; StdCall;
    where ProjectFile is *.info file (*.model file must be in same directory), UpdateFile is updated database file and UpdCallBack is callback function for getting information about process of updating, definitions is:
    TUpdCallBack= procedure (Error: boolean; InfoStr, ErrStr: PChar) of object;
  • function returns true if database was updated sucesfully, in other case returns false
  • important notice: updated database must be closed in your application before calling MDBUpdate.dll, in other case update fails


Download demo for detailed demonstration of DB Version Update tool.


Back
Contact:
Tomas Rosinsky
Czech Republic
e-mail: delphi@rosinsky.cz
All products are for Microsoft Windows
Components are tested with Delphi 6,7, 2005, 2006, 2007, 2009 and 2010
Number of visitors:
Your order will be processed by:
BMT Micro