aboutsummaryrefslogtreecommitdiffstats
path: root/unicode/src/base/UDataBase.pas
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-07-23 18:09:11 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-07-23 18:09:11 +0000
commit21c1082f916cc9a4d7be625c132e02b1fc1d8012 (patch)
treecf3c705058db9839ba80cebfaf0fe69086fa38f2 /unicode/src/base/UDataBase.pas
parent446eec893b7915d80a4504d40bbfc6f77cafa550 (diff)
downloadusdx-21c1082f916cc9a4d7be625c132e02b1fc1d8012.tar.gz
usdx-21c1082f916cc9a4d7be625c132e02b1fc1d8012.tar.xz
usdx-21c1082f916cc9a4d7be625c132e02b1fc1d8012.zip
- IPath integration
- BASS is now unicode compatible git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1875 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--unicode/src/base/UDataBase.pas23
1 files changed, 12 insertions, 11 deletions
diff --git a/unicode/src/base/UDataBase.pas b/unicode/src/base/UDataBase.pas
index 87e9519c..90cee974 100644
--- a/unicode/src/base/UDataBase.pas
+++ b/unicode/src/base/UDataBase.pas
@@ -34,10 +34,11 @@ interface
{$I switches.inc}
uses
+ Classes,
+ SQLiteTable3,
USongs,
USong,
- Classes,
- SQLiteTable3;
+ UPath;
//--------------------
//DataBaseSystem - Class including all DB Methods
@@ -88,16 +89,16 @@ type
TDataBaseSystem = class
private
ScoreDB: TSQLiteDatabase;
- fFilename: string;
+ fFilename: IPath;
function GetVersion(): integer;
procedure SetVersion(Version: integer);
public
- property Filename: string read fFilename;
+ property Filename: IPath read fFilename;
destructor Destroy; override;
- procedure Init(const Filename: string);
+ procedure Init(const Filename: IPath);
procedure ReadScore(Song: TSong);
procedure AddScore(Song: TSong; Level: integer; const Name: UTF8String; Score: integer);
procedure WriteScore(Song: TSong);
@@ -128,19 +129,19 @@ const
(**
* Opens Database and Create Tables if not Exist
*)
-procedure TDataBaseSystem.Init(const Filename: string);
+procedure TDataBaseSystem.Init(const Filename: IPath);
var
Version: integer;
begin
if Assigned(ScoreDB) then
Exit;
- Log.LogStatus('Initializing database: "'+Filename+'"', 'TDataBaseSystem.Init');
+ Log.LogStatus('Initializing database: "'+Filename.ToNative+'"', 'TDataBaseSystem.Init');
try
// Open Database
- ScoreDB := TSQLiteDatabase.Create(Filename);
+ ScoreDB := TSQLiteDatabase.Create(Filename.ToUTF8);
fFilename := Filename;
// Close and delete outdated file
@@ -150,10 +151,10 @@ begin
Log.LogInfo('Outdated cover-database file found', 'TDataBaseSystem.Init');
// Close and delete outdated file
ScoreDB.Free;
- if (not DeleteFile(Filename)) then
- raise Exception.Create('Could not delete ' + Filename);
+ if (not Filename.DeleteFile()) then
+ raise Exception.Create('Could not delete ' + Filename.ToNative);
// Reopen
- ScoreDB := TSQLiteDatabase.Create(Filename);
+ ScoreDB := TSQLiteDatabase.Create(Filename.ToUTF8);
Version := 0;
end;