Graeme's Wiki

techtest
Some useful reference material.

Database Models

Some database models for a CD Collection type application.

http://www.databaseanswers.org/data_mode.../index.htm

http://www.databaseanswers.org/data_mode..._model.htm

http://www.databaseanswers.org/data_mode...ysical.htm

Next OID for tiOPF

If using tiOPF and letting it handle OID values as High/Low Integers, then this is the table that you would need.

CREATE TABLE NEXT_OID ( OID INTEGER NOT NULL, CONSTRAINT PK_NEXT_OID PRIMARY KEY (OID) );

INSERT INTO NEXT_OID VALUES (1);

MS SQL Server

How to create a MS SQL Server Express database from the command line:
Server could = .\SQLEXPRESS
sqlcmd -U <user> -P <password> -S <server> -Q "CREATE DATABASE mydatabase"

Here is a useful batch file to work with MS SQL Server Express 2008 where you don't have the Management Studio software to work with the database in a graphical way. This batch file does every thing with the command line tool.

@echo off

REM  Update the path to the SqlCmd.exe if needed
@set SQLCMD="c:\Program Files\Microsoft SQL Server\100\Tools\Binn\SQLCMD.EXE"

REM  Update these settings to match your environment
@set SERVER=localhost\SQLEXPRESS
@set DB=panacee
@set USER=sa
@set PASSWD=masterkey

echo Dropping existing database tables
%SQLCMD% -S %SERVER% -d %DB% -U %USER% -P %PASSWD% -i "000 drop_mssqlserver.sql"

echo Creating the database tables
%SQLCMD% -S %SERVER% -d %DB% -U %USER% -P %PASSWD% -i "001\001 create_mssqlserver.sql"

echo Inserting default data
%SQLCMD% -S %SERVER% -d %DB% -U %USER% -P %PASSWD% -i "001\002 defaults.sql"

TODO List

To keep track of what needs to be done and what is still outstading, use the following todo list - it's easier than Delphi's TODO comments in the various code units.

  TODO List

Legend
======
[ ] - not started yet
[o] - started but not complete
[x] - completed task.


Application
==============
[ ] - task one
[ ] - task two


Completed
==============
[x] - Some completed task goes here


Useful utility functions

function TDataModule1.CreateGUIDString: string;
const
  cGUIDLength = 38;
var
  uid: TGuid;
  r: HResult;
begin
  r := CreateGuid(uid);
  if r = S_OK then
  begin
    Result := GUIDToString(uid);
    //           10        20        30
    // 01234567890123456789012345678901234567
    // {81A9C48C-DEF3-11D6-81C4-0002E31296EB}
    // A GUID will be 38 chars long when created,
    // or 36 chars long when {} are removed.
    if (Result[1] = '{') and (Result[cGUIDLength] = '}') then
      Result := Copy(Result, 2, cGUIDLength - 2);
  end;
end;

More useful resources