Database structure version tracking 
Author Message
 Database structure version tracking

What's the best technique for tracking the version of a database
structure?  For example, suppose I write an application that uses a
database.  At some point in the future I may have to change the
database structure.  I will want the code to detect the structure
version of the database so I can update the database.

Ideally the structure version would be stored in the database file to
prevent disassociation.

TIA
--



Tue, 02 Mar 1999 03:00:00 GMT  
 Database structure version tracking

Quote:

> What's the best technique for tracking the version of a database
> structure?  For example, suppose I write an application that uses a
> database.  At some point in the future I may have to change the
> database structure.  I will want the code to detect the structure
> version of the database so I can update the database.

> Ideally the structure version would be stored in the database file to
> prevent disassociation.

> TIA
> --


   What has been done with the project I am currently on is to include a
System Parameters table.  This table is put in the \windows\system
directory with it's system, hidden, and read-only modes set to help
prevent tampering and has information specific to the client, such as
name, phone, address, contact person, number of users, UI version, and
database version.
   Hope that helps!!

Charles E. Robinson



Tue, 02 Mar 1999 03:00:00 GMT  
 Database structure version tracking

Quote:

>What's the best technique for tracking the version of a database
>structure?  For example, suppose I write an application that uses a
>database.  At some point in the future I may have to change the
>database structure.  I will want the code to detect the structure
>version of the database so I can update the database.
>Ideally the structure version would be stored in the database file to
>prevent disassociation.

Thanks for the ideas, posted here and via email.  I think I found a
better solution.

Apparently the BDE keeps a structure version number, at least for
Paradox files.  (I don't know about dBase or others.)  Whenever you
change the structure (in Database Desktop, for instance) the BDE
increments the version number.  The following unit provides a function
that returns the structure database version:

(*****************************************************************************
* DbUtils.pas
*
* Database Utilities
*
* 09/20/96 WTR - created
*****************************************************************************)
unit Dbutils;

(****************************************************************************)
(****************************************************************************)
  interface
(****************************************************************************)
(****************************************************************************)

uses
  DbTables;

function DbGetVersion(table: TTable): LongInt;

(****************************************************************************)
(****************************************************************************)
  implementation
(****************************************************************************)
(****************************************************************************)

uses
  Db, DbiProcs, DbiTypes, {DbiErrs,}
  SysUtils;

{---------------------------------------------------------------------------}
(*
 * Purpose:    determine the version number of the specified table
 * Parameters: table (I) - table of interest
 * Returns:    version number
 * Exceptions: EDatabaseError
 *)
function DbGetVersion(table: TTable): LongInt;
var
  hCursor  : hDBICur;
  tableDesc: TBLFullDesc;
  cName    : array[0..255] of Char;
begin
  { make c-string copy table name }
  StrPCopy(cName, table.TableName);

  { ask BDE to create info record for specified table }
  Check(DbiOpenTableList(table.DBHandle, True, False, cName,
hCursor));

  { get info record into structure }

  { get version field from extended portion }
  Result := tableDesc.tblExt.iRestrVersion;

  Check(DbiCloseCursor(hCursor));
end;

end.
--



Tue, 16 Mar 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Updating database structures with new program versions

2. How to track database activity?

3. modifying database structure from Delphi

4. Modifying database table structure

5. Transfer database connections - Specific ADO DataLink File structure??

6. Access Database Structure

7. How do I print a database structure.

8. Database structure

9. Print database file structure

10. Print database file structure

11. SCANNER - Database structure coder

12. HOW Do I Make Copy Of The Database Structure

 

 
Powered by phpBB® Forum Software