Database

Amazon RDS – PostgreSQL Features

PostgreSQL is a powerful, open source object-relational database system which has earned a strong reputation for reliability, feature robustness, and performance. AWS RDS runs various versions of PostgreSQL. It supports point-in-time restore and backups, creation […]

Database

Amazon RDS – MySQL Features

MySQL is a popular Relational DB which is available in the amazon RDS services with its community edition features. Almost every feature of MYSQL can be leveraged in the RDS platform with only some restrictions […]

Database

Amazon RDS – Multi-AZ Deployments

In a Multi-AZ deployment, Amazon RDS automatically provisions and maintains a synchronous standby replica in a different Availability Zone. The primary DB instance is synchronously replicated across Availability Zones to a standby replica to provide […]

Database

Amazon RDS – DB Snapshots

Amazon RDS creates automated backups of your DB instance during the backup window of your DB instance and stores them as volume snapshots. Automated Backup For Automated backup to work properly, followings are the criteria. […]

Database

Select a random datarecord

Select a random datarecord procedure TForm1.FormCreate(Sender: TObject); begin Randomize; end; procedure TForm1.Button1Click(Sender: TObject); begin Table1.First; Table1.MoveBy(Random(Table1.RecordCount)); end;

Database

Add a password to a paradox table

Add a password to a paradox table uses Bde, SysUtils, dbtables, windows; function StrToOem(const AnsiStr: string): string; begin SetLength(Result, Length(AnsiStr)); if Length(Result) 0 then CharToOem(PChar(AnsiStr), PChar(Result)); end; function TablePasswort(var Table: TTable; password: string): Boolean; var […]

Database

BDE Error list

BDE Error list: $0000 (0) = Successful completion. $0021 (33) = System Error $0022 (34) = Object of Interest Not Found $0023 (35) = Physical Data Corruption $0024 (36) = I/O Related Error $0025 (37) […]

Database

Show a TTable’s deleted records

Show a TTable’s deleted records procedure DeletedRecords(Table: TTable; SioNo: Boolean); begin Table.DisableControls; try Check(DbiSetProp(hDBIObj(Table.Handle), curSOFTDELETEON, Longint(SioNo))); finally Table.EnableControls; end; Table.Refresh; end;

Database

Undelete a dBASE record

Undelete a dBASE record procedure RecordUndelete(aTable: TTable); begin aTable.UpdateCursorPos; try Check(DbiUndeleteRecord(aTable.Handle)); except ShowMessage(‘No undelete performed.’); end; end;

Database

Save a Formula One spreadsheet to a blob field

Save a Formula One spreadsheet to a blob field uses vcf1, dbtables; procedure SaveSpreadsheet(F1Book: TF1Book); var BlobStream: TBlobStream; MyBlob: HGlobal; pblob: Pointer; begin with Datamodule1.Query1 do begin Set8087CW($133f); try Application.ProcessMessages; F1Book.SaveWindowInfo; MyBlob := GlobalAlloc(GMEM_MOVEABLE, 2000); […]

Database

Remove a dbase index flag

Remove a dbase index flag function UnCheckIndex(FileDbf: string): Boolean; var Dbf: file; Car: Char; begin Result := T; AssignFile(Dbf, FileDbf); Car := #0; {$I-} Reset(Dbf, 1); if not ErrorIO(FileDbf, IoResult) then begin Seek(Dbf, 28); {Flag’s […]

Database

Pack a Table

Pack a Table Packs a Paradox table by calling the BDE DbiDoRestructure function. The TTable passed as the first parameter must be closed. The TDatabase passed as the second parameter must be connected. function dgPackParadoxTable(Tbl: […]

Database

Select all Fields in a DBGrid

Select all Fields in a DBGrid function GridSelectAll(Grid: TDBGrid): Longint; begin Result := 0; Grid.SelectedRows.Clear; with Grid.DataSource.DataSet do begin First; DisableControls; try while not EOF do begin Grid.SelectedRows.CurrentRowSelected := True; Inc(Result); Next; end; finally EnableControls; […]

Database

Extract the ODBC System Data Sources

Extract the ODBC System Data Sources uses Registry; procedure TForm1.Button1Click(Sender: TObject); var n: Integer; List: TStringList; Reg: TRegistry; begin Reg := TRegistry.Create; try Reg.RootKey := HKEY_CURRENT_USER; Reg.LazyWrite := False; Reg.OpenKey(‘Software\ODBC\ODBC.INI\ODBC Data Sources’, False); List := […]

Database

Accelerate database searches

Accelerate database searches type TForm1 = class(TForm) DataSource1: TDataSource; Table1: TTable; Button1: TButton; end; procedure TForm1.Button1Click(Sender: TObject); var SeekValue: string; begin Table1.DisableControls; Table1.FindKey([SeekValue]); Table1.EnableControls; end;

Database

Make an ADODB Connection using OLE-Automation

Make an ADODB Connection using OLE-Automation uses ComObj; function OpenConnection(ConnectionString: AnsiString): Integer; var ADODBConnection: OleVariant; begin ADODBConnection := CreateOleObject(‘ADODB.Connection’); ADODBConnection.CursorLocation := 3; // User client ADODBConnection.ConnectionString := ConnectionString; Result := 0; try ADODBConnection.Open; except Result […]

Database

Load all records at once into a Stringlist

{ Loading millions of records into a stringlist can be very slow } procedure TForm1.SlowLoadingIntoStringList(StringList: TStringList); begin StringList.Clear; with SourceTable do begin Open; DisableControls; try while not EOF do begin StringList.Add(FieldByName(‘OriginalData’).AsString); Next; end; finally EnableControls; […]

Database

Move Columns in a TDBGrid

Move Columns in a TDBGrid type THackAccess = class(TCustomGrid); { THackAccess Is needed because TCustomGrid.MoveColumn is protected and you can’t access it directly. } // In the implementation-Section: procedure MoveDBGridColumns(DBGrid: TDBGrid; FromColumn, ToColumn: Integer); begin […]

Database

Prevent Data Corruption

{ If a database or a table is local on a PC installed (Paradox or Dbase) and the BDE-setting “LOCAL SHARE” is FALSE, then changings are not stored immediatly but are kept in the memory. […]

Database

Export a TDataSet to a XML file

{Unit to export a dataset to XML} unit DS2XML; interface uses Classes, DB; procedure DatasetToXML(Dataset: TDataSet; FileName: string); implementation uses SysUtils; var SourceBuffer: PChar; procedure WriteString(Stream: TFileStream; s: string); begin StrPCopy(SourceBuffer, s); Stream.Write(SourceBuffer[0], StrLen(SourceBuffer)); end; […]