aboutsummaryrefslogtreecommitdiffstats
path: root/src/base/UDataBase.pas (unfollow)
Commit message (Collapse)AuthorFilesLines
2009-12-06Add Date to Score, Filter Players, Switch Difficulty - ID: 2901824s_alexander1-50/+77
applied patch form sf.net bug tracker (id: 2901824) thanks to brunzelchen - Add a date-column to the score entries (UNIX-Timestamp); the date will be shown on Top5- und Stats Screen! - The Players on Top-5-Screen are now filtered: Every player with his best score! - You can switch through the difficulties on Top-5-Screen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1972 b956fd51-792f-4845-bead-9b4dfca2ff2c
2009-11-09merged unicode branch (r1931) into trunks_alexander1-81/+82
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1939 b956fd51-792f-4845-bead-9b4dfca2ff2c
2009-07-18some modifications on the DataBaseLoadingb_krueger1-9/+28
- now ALL databases in table "us_songs" gets the column "Rating" - nicer Structure and some useful comments -> should work now with all DB-loading-combinations! git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1851 b956fd51-792f-4845-bead-9b4dfca2ff2c
2009-07-18cosmetics. no code change.k-m_schindler1-32/+33
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1848 b956fd51-792f-4845-bead-9b4dfca2ff2c
2009-07-18- Commented delay of error.log in mainloop (error-log is no longer generated ↵b_krueger1-21/+29
without any error) - If an old 1.01 Ultrastar.db exists, it will no longer deleted on startup, it will be converted into the new 1.1 schema --> added new column in us_songs: rating. This will allow to rate songs in upcoming versions git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1847 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-10-28some compiler warnings/hints removedtobigun1-1/+0
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1485 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-09-23indentation unified, no code change.k-m_schindler1-4/+5
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1406 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-09-23gpl header added and property svn:header set to "HeadURL Id"k-m_schindler1-0/+25
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1403 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-09-02Moved: The folder classes has been renamed to basemogguh1-0/+0
Updated: ultrastardx.dpr has been changed accordingly git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1339 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-08-27rename Classes part2k-m_schindler1-0/+0
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1308 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-08-27rename Classes part1k-m_schindler1-0/+0
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1307 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-08-27Reordering of the directories[1]: moving Game/Code to srck-m_schindler1-0/+0
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1302 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-08-08somw warnings removedtobigun1-1/+4
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1231 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-08-08- TStatResult is an abstract class now.tobigun1-65/+82
- GetStats returns a TList of TStatResult now - Free the result-list with FreeStats git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1230 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-08-07- Reset-Timestamp changed from STRING to INTEGER (stored as UNIX-timestamp)tobigun1-11/+43
- Version-number for database-file added git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1229 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-08-07- Introduced TStatType.tobigun1-119/+139
- Replaced TSQLiteTable with the new TSQLiteUniTable. The ..UniTable-version does not retrieve data at once (this feature is not needed/wanted in most cases). The major advantage of this version is a better handling of datatypes. TSQLiteTable does not handle datatypes correctly (and even crashes) if the field-types are not one of the SQLite types (e.g. an INT(12) field will crash if it accessed by FieldAsInteger, the same applies to "integer" but the upper-case version "INTEGER" works). With TSQLiteUniTable those crashes should not occur. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1228 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-08-07SUM/COUNT replaced by AVGtobigun1-5/+5
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1227 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-08-07- strings are bound now to avoid failures with unquoted stringstobigun1-192/+243
- better error/exception handling - Strings (PlayerName, Artist, Title) are stored as UTF8 - TSQLiteTable objects returned by GetTable() are freed now. Memory was not released before causing memory leaks. - replaced `` with []. Both are not ANSI SQL compatible, `` is used in MySQL, [] in MSSQL. In contrast to `` SQLite states that [] is supported. "" is not used as it is interpreted as a string if an identifier with this name does not exist. This will make debugging mor difficult as SQLite does not return an error code if an identifier was misspelled. - cleanup git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1226 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-07-19Some changes in ReadScore and WriteScore to prevent for crashes caused by ↵whiteshark01-3/+14
more than 5 score entrys per song/difficulty git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1216 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-07-12unit UScreenStatMain;GogolNr11-5/+29
interface {$IFDEF FPC} {$MODE Delphi} {$ENDIF} {$I switches.inc} uses UMenu, SDL, SysUtils, UDisplay, UMusic, UIni, UThemes; type TScreenStatMain = class(TMenu) private //Some Stat Value that don't need to be calculated 2 times SongswithVid: Cardinal; public TextOverview: integer; constructor Create; override; function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure SetAnimationProgress(Progress: real); override; procedure SetOverview; end; implementation uses UGraphic, UDataBase, USongs, USong, ULanguage, UCommon, {$IFDEF win32} windows, {$ELSE} sysconst, {$ENDIF} ULog; function TScreenStatMain.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; begin Result := true; If (PressedDown) Then begin // Key Down // check normal keys case WideCharUpperCase(CharCode)[1] of 'Q': begin Result := false; Exit; end; end; // check special keys case PressedKey of SDLK_ESCAPE, SDLK_BACKSPACE : begin Ini.Save; AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenMain); end; SDLK_RETURN: begin //Exit Button Pressed if Interaction = 4 then begin AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenMain); end else //One of the Stats Buttons Pressed begin AudioPlayback.PlaySound(SoundLib.Back); ScreenStatDetail.Typ := Interaction; FadeTo(@ScreenStatDetail); end; end; SDLK_LEFT: begin InteractPrev; end; SDLK_RIGHT: begin InteractNext; end; SDLK_UP: begin InteractPrev; end; SDLK_DOWN: begin InteractNext; end; end; end; end; constructor TScreenStatMain.Create; var I: integer; begin inherited Create; TextOverview := AddText(Theme.StatMain.TextOverview); LoadFromTheme(Theme.StatMain); AddButton(Theme.StatMain.ButtonScores); if (Length(Button[0].Text)=0) then AddButtonText(14, 20, Theme.StatDetail.Description[0]); AddButton(Theme.StatMain.ButtonSingers); if (Length(Button[1].Text)=0) then AddButtonText(14, 20, Theme.StatDetail.Description[1]); AddButton(Theme.StatMain.ButtonSongs); if (Length(Button[2].Text)=0) then AddButtonText(14, 20, Theme.StatDetail.Description[2]); AddButton(Theme.StatMain.ButtonBands); if (Length(Button[3].Text)=0) then AddButtonText(14, 20, Theme.StatDetail.Description[3]); AddButton(Theme.StatMain.ButtonExit); if (Length(Button[4].Text)=0) then AddButtonText(14, 20, Theme.Options.Description[4]); Interaction := 0; //Set Songs with Vid SongswithVid := 0; For I := 0 to Songs.SongList.Count -1 do if (TSong(Songs.SongList[I]).Video <> '') then Inc(SongswithVid); end; procedure TScreenStatMain.onShow; begin inherited; //Set Overview Text: SetOverview; end; procedure TScreenStatMain.SetOverview; type TwSystemTime = record wYear, wMonth, wDayOfWeek, wDay, wHour, wMinute, wSecond, wMilliseconds: Word; end; var Overview, Formatstr: String; I: Integer; //Some Vars to Save Attributes to A1, A2, A3: Integer; A4, A5: String; Result1, Result2: AStatResult; ResetTime: TSystemTime; begin //Song Overview //Introduction Formatstr := Language.Translate ('STAT_OVERVIEW_INTRO'); (*Format: %0:d Ultrastar Version %1:d Day of Reset (A1) %2:d Month of Reset (A2) %3:d Year of Reset (A3)*) DateTimeToSystemTime(Database.GetStatReset, ResetTime); // ResetTime := GetFileCreation(Database.Filename); {$IFDEF MSWINDOWS} A1 := ResetTime.wDay; A2 := ResetTime.wMonth; A3 := ResetTime.wYear; {$ELSE} A1 := ResetTime.Day; A2 := ResetTime.Month; A3 := ResetTime.Year; {$ENDIF} try Overview := Format(Formatstr, [Language.Translate('US_VERSION'), A1, A2, A3]); except on E: EConvertError do Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_INTRO": ' + E.Message); end; Formatstr := Language.Translate ('STAT_OVERVIEW_SONG'); {Format: %0:d Count Songs (A1) %1:d Count of Sung Songs (A2) %2:d Count of UnSung Songs %3:d Count of Songs with Video (A3) %4:s Name of the most popular Song} A1 := Songs.SongList.Count; A2 := Database.GetTotalEntrys(2); A3 := SongswithVid; SetLength(Result1, 1); Database.GetStats(Result1, 2, 1, 0, False); A4 := Result1[0].Artist; A5 := Result1[0].Title; try Overview := Overview + '\n \n' + Format(Formatstr, [A1, A2, A1-A2, A3, A4, A5]); except on E: EConvertError do Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_SONG": ' + E.Message); end; //Player Overview Formatstr := Language.Translate ('STAT_OVERVIEW_PLAYER'); {Format: %0:d Count Players (A1) %1:s Best Player (Result) %2:d Best Players Score %3:s Best Score Player (Result2) %4:d Best Score} A1 := Database.GetTotalEntrys(1); SetLength(Result1, 1); Database.GetStats(Result1, 1, 1, 0, False); SetLength(Result2, 1); Database.GetStats(Result2, 0, 1, 0, False); try Overview := Overview + '\n \n' + Format(Formatstr, [A1, Result1[0].Player, Result1[0].AverageScore, Result2[0].Singer, Result2[0].Score]); except on E: EConvertError do Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_PLAYER": ' + E.Message); end; Text[0].Text := Overview; end; procedure TScreenStatMain.SetAnimationProgress(Progress: real); var I: Integer; begin For I := 0 to high(Button) do Button[I].Texture.ScaleW := Progress; end; end. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1186 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-05-08added "inherited ..." to all constructors to assure that the base-class ↵tobigun1-2/+2
constructor is called. Different to C or Java, the constructor or destructor of the base class (except that of TObject) is not called by default if "inherited ..." is not given (very strange). This is no problem with classes inherited directly from TObject, because the TObject constructor is always called (and sets the values of the fields to 0-values) but i added inherited to these constructors too because the base class may change from TObject to something different and the "inherited" will probably not added in this case and causing problems. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1070 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-05-02TCoreModule overloads the Free destructor "destructor Free" with a self ↵tobigun1-3/+3
defined "procedure Free". At least Free should not be defined explicitly because there already is a default Free() implementation that checks if the reference is nil and if not, calls Destroy. Making the destructor a procedure does not look correct too. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1054 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-05-02- replaced some DebugWriteln() with Log.Log...() tobigun1-3/+6
- added LogFileLevel to be able to control which log-messages are written to the log-file (Error.log) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1053 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-04-27Removed misleading "var" parameters at ReadScore etc.: TSong is a class now, ↵tobigun1-6/+6
so parameters of this type are copied by reference -> no need to use "var" to prevent copying. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1038 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-04-19tried to make songloading working with the old loader and keep all changes ↵s_alexander1-312/+86
that were made since starting to work on a new one *hope that worked* you may delete your existing cover.cache (the cover cache is still NOT working) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1024 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-03-31git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@987 ↵whiteshark01-37/+75
b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-03-30Reimplemented all old features of Databasewhiteshark01-74/+67
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@985 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-03-30New Database Structure Init readywhiteshark01-11/+70
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@984 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-03-30Prepared some classes for enhanced Song loading.whiteshark01-15/+151
Commited to work with s_alexander in this task. Song loading doesn't work at this point git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@983 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-03-26added "-debug" flag at run time and "CONSOLE" Define in switches.inc jaybinks1-7/+10
also the default is to run with no debug info sent to the console git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@973 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-03-09Fixed some warnings ("missing result-values", "0 instead of nil", ↵tobigun1-14/+19
"comparison is always true", "range check errors") git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@946 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-03-06Translated German comments to Englishf1fth_freed0m1-1/+1
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@918 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-03-04Patchs from AlexanderS & f1fth_freed0mjaybinks1-8/+9
also some minor bug fixes from myself. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@904 b956fd51-792f-4845-bead-9b4dfca2ff2c
2008-01-12bunch of smaller changes...jaybinks1-0/+1
some changes to song loading... Record global changed to singleton object started implementing mic volume display in Settings-Record hope this dosnt break anything.. :P git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@789 b956fd51-792f-4845-bead-9b4dfca2ff2c
2007-11-01fixed failed buildsjaybinks1-0/+4
build:USDX-LAZLIN-75 build:USDX-LAZLIN-76 for some reason we can not use {$MODE Delphi} in an included file. ( Probably because of the way the compier scopes this switch to each pas file ) ive had to revert this part of eddies changes. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@548 b956fd51-792f-4845-bead-9b4dfca2ff2c
2007-11-01Mac OS X version compiles and links. I hope I didn't break too many files on ↵eddie-08151-4/+1
windows/linux. Added switches.inc to all files. Changed many IFDEFs. For Windows-only code please use MSWINDOWS instead of WIN32 now. WIN32 is also used by the Mac port. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@546 b956fd51-792f-4845-bead-9b4dfca2ff2c
2007-10-08trying to fix linux runtime errors with database ( Stats screen )jaybinks1-56/+119
and Song Selection screen ( now back to kina working ) Testing Fisheye Links (please ignore): jira#USDX-1 sf#1790165 build#USDX-DELPHI-26 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@469 b956fd51-792f-4845-bead-9b4dfca2ff2c
2007-09-20Ultrastar-DX now compiles in linux jaybinks1-299/+298
(using lazarus) Bass etc is commented out.. but it compiles, and im working through the runtime errors. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@408 b956fd51-792f-4845-bead-9b4dfca2ff2c
2007-09-18changes in order to compile in lazarus...jaybinks1-0/+5
minor tidy ups and removal of big old comment blocks.. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@394 b956fd51-792f-4845-bead-9b4dfca2ff2c
2007-06-12Fixed a Bug in Database Systemwhiteshark01-2/+2
thx to Pr3D@ToR git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@260 b956fd51-792f-4845-bead-9b4dfca2ff2c
2007-04-19Added Statistic Screens to C0de and to Themewhiteshark01-0/+131
Moved some Translated Strings from UScreenPartyOptions to UTheme to use it with the Statistic Screens, too. Fixed use of /n Tag istead of the correct \n git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@118 b956fd51-792f-4845-bead-9b4dfca2ff2c
2007-03-23Some Changes on Database System and Header Readerwhiteshark01-0/+163
Fixed Bug: Scores with 0 are added to DB Made a Class instead of many Functions Fixed a Bug in UFiles, not reading Gap from Header correctly git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@20 b956fd51-792f-4845-bead-9b4dfca2ff2c