|
|
|
Hi, and welcome to this readme file for TmySQL.
This a set of classes that can be used in delphi along with the libmysql.dll file.
The newest version should be found at http://members.xoom.com/qabi/TmySQL/TmySQL.zip
|
Just unzip the archive to any directory you'd like it, and include it into your Delphi project.
The required 'libmysql.dll' file is included. (Version 3.22.14-gamma - this can be replaced with a newer version, but it might not work).
|
unit MySql; interface uses classes, dialogs, sysutils; type // ------------------- Class declaration: TField ----------------------------- TField = class public Name: String; FieldType: String; Constructor Create(aName: String); end; // ------------------- Class declaration: TFields ---------------------------- TFields = class public Constructor Create(res: pmysql_res); Destructor Destroy; override; Function Count: Integer; Property Fields[Index: Integer]: TField read getField; default; Procedure Add(Value: TField); end; // ------------------- Class declaration: TTable ----------------------------- TTable = class public Name: String; Fields: TFields; FieldInfo: TResult; Constructor Create(aMySql: pmysql; aName: String); Destructor Destroy; override; end; // ------------------- Class declaration: TTables ---------------------------- TTables = class public Constructor Create(aMySql: pmysql; aName: String); Destructor Destroy; override; Function Count: Integer; Property Tables[Index: Integer]: TTable read getTable; default; Procedure Add(Value: TTable); end; // ------------------- Class declaration: TDatabase -------------------------- TDatabase = class public Name: String; Selected: Boolean; Tables: TTables; Constructor Create(aMySql: pmysql; aName: String); Destructor Destroy; override; Function Select: Boolean; end; // ------------------- Class declaration: TDatabases ------------------------- TDatabases = class public Constructor Create(aMySql: pmysql); Destructor Destroy; override; Function Count: Integer; Property Databases[Index: Integer]: TDatabase read getDatabase; default; Procedure Add(Value: TDatabase); end; // ------------------- Class declaration: TRow ------------------------------- TRow = class public Constructor Create(aRow: TStringList); Destructor Destroy; override; Function Count: Integer; Property Databases[Index: Integer]: String read getValue; default; Procedure Add(Value: String); end; // ------------------- Class declaration: TRows ------------------------------ TRows = class public Constructor Create(res: pmysql_res; Count: Integer); Destructor Destroy; override; Function Count: Integer; Property Rows[Index: Integer]: TRow read getRow; default; Procedure Add(Value: TRow); end; // ------------------- Class declaration: TResult ---------------------------- TResult = class public Rows: TRows; Fields: TFields; AffectedRows: Integer; Constructor Create(res: pmysql_res; aMySql: pmysql); Destructor Destroy; override; Function lastError: String; end; // ------------------- Class declaration: TMySql ----------------------------- TMySql = class public class function ClientVersion: String; constructor CreateConnect(aHost, aUser, aPassword: String; aPort: Integer); destructor Destroy; override; function Connect: Boolean; function Disconnect: Boolean; function Connected: boolean; Property Name: String read getName write setName; Property Host: String read getHost write setHost; Property User: String read getUser write setUser; Property Password: String read getPassword write setPassword; Property Port: Integer read getPort write setPort; function getVersion: String; function getHostInfo: String; function getProtocolVersion: Integer; function getThreadId: Longint; function getStat: String; function getProcesses: TResult; function getDatabases: TDatabases; function Query(sql: String): TResult; function SelectDb(d: String): Boolean; function CreateDb(name: String): Boolean; function DeleteDb(name: String): Boolean; function RefreshGrants: Boolean; end;
|
The only class that should ever be constructed by the user is TmySQL. The others are constructed and destroyed automatically.
To Create a TmySQL either use Create, or CreateConnect which also tries to connect right away.
TmySQL.getDatabases returns
TDatabases TDatabase TTables TTable TFields TField
TmySQL.Query (and .getProcesses) returns
TResult TFields TField TRows TRow String
|
This program is freeware, for personal use. Go ahead and copy it, use it or do whatever you feel like.
I would, however, appreciate donations in any form and/or shape (even postcards and emails). These donations would be considered as supporting the TmySQL project.
Commercial interests, however, must pay US$ 20 for a license to use these classes. (The full source code can also be bought)
My Address is:
Hillware I/S Dennis Thrysøe Solvangsvej 6, st, th DK-9000 Aalborg <qabi@mindless.com> http://members.xoom.com/qabi/
This product is:
Copyright ® 1999 by Hillware I/S, Dennis Thrysøe
|
It shouldn't be a secret that I'm somewhat inspired by David B. Mansels I also had some use for Blestan Tabakov's Also, thanks to TCX DataKonsult AB (especially Monty) for helping me out. (And releasing mySQL!).
Release history
TmySQL 1.0.0.0
-------------------------
Small insignifigant things fixed.
Let me know if you find any bugs,
and I'll try to fix them as soon
as possible.
TmySQL 1.0.0.99XXXX
-------------------------
First release.
This is a freeware release. No license is included, nor required as long as you are using it personally, and not commercially.
License
Copyright © Hillware I/S (Dennis Thrysøe) 1999, all rights reserved.