C# Class Nagru___Manga_Organizer.SQL

Controls access to the database
显示文件 Open project: Nagru/Manga-Organizer Class Usage Examples

Public Methods

Method Description
BeginTransaction ( ) : int

Starts a new transaction USE WITH CAUTION: SQLite DOES NOT SUPPORT MULTIPLE TRANSACTIONS

CleanUpArtists ( ) : int

Deletes all unused artists from the DB

CleanUpReferences ( ) : int

Re-creates the MangaTag table to remove PK value gaps

CleanUpTags ( ) : int

Deletes all unused tags from the DB

CommitTransaction ( ) : int

Commits the current transaction

Connect ( ) : bool

Opens a connection to the database and imports any previous Manga DB's if possible

ContainsEntry ( string Artist, string Title ) : bool

Returns whether the entry exists in the DB

DeleteManga ( int mangaID ) : bool

Deletes an entry from the database

DeleteTag ( string TagText ) : int

Deletes a tag based on the text passed in

Disconnect ( bool Recycle = false ) : void

Vacuum's the DB and closes the connection

GetAllManga ( string SearchText = null, int MangaID = -1 ) : DataTable

Returns the details of every manga in the database

GetArtists ( ) : string[]

Returns all the artists in the database

GetDefaultType ( ) : string

Returns the default manga category

GetLogContents ( ) : DataTable

Returns the details of everything logged so far

GetManga ( int mangaID ) : DataTable

Returns the full details of a specified manga

GetMangaDetail ( int mangaID, Manga Column ) : string

Returns a single detail of a specified manga

GetMangaTitle ( int mangaID ) : string

Returns the EH formatted title of a Manga

GetSetting ( Setting DBSetting ) : object

Returns a setting from the DB

GetTags ( ) : string[]

Returns all the tags in the database

GetThumbnail ( int MangaID ) : Image

Returns the manga's thumbnail

GetTypes ( ) : string[]

Returns all the manga types in the database

HasThumbnail ( int MangaID ) : bool

Returns true if the entry has a thumbnail for it

IsConnected ( ) : bool

Returns whether or not the DB connection is currently open

LogMessage ( Exception exception, EventType eventType, object Source = null ) : bool

Logs exception details to the DB to support future debugging

LogMessage ( string LogMessage, EventType eventType, object Source = null ) : bool

Logs exception details to the DB to support future debugging

RollbackTransaction ( ) : int

Rollbacks the current transaction

SaveManga ( string Artist, string Title, System.DateTime PublishedDate, string Tags = null, string Location = null, decimal Pages, int PageReadCount = -1, string Type = null, decimal Rating, string Description = null, string URL = null, bool ReadManga = false, int MangaID = -1 ) : int

Insert or updates a manga

SaveReadProgress ( int MangaID, int PageReadCount = -1 ) : int

Stores the last page read of a manga and updates it's read status

SaveThumbnail ( int MangaID, Image image ) : bool

Saves a thumbnail image to the database

UpdateSetting ( Setting DBSetting, object setting ) : bool

Update the indicated setting

VacuumDatabase ( ) : bool

Runs the vacuum command on the database to reduce filesize if possible

Private Methods

Method Description
SQL ( ) : System

Instantiates the non-static sqlBase that holds the DB connection

Method Details

BeginTransaction() public static method

Starts a new transaction USE WITH CAUTION: SQLite DOES NOT SUPPORT MULTIPLE TRANSACTIONS
public static BeginTransaction ( ) : int
return int

CleanUpArtists() public static method

Deletes all unused artists from the DB
public static CleanUpArtists ( ) : int
return int

CleanUpReferences() public static method

Re-creates the MangaTag table to remove PK value gaps
public static CleanUpReferences ( ) : int
return int

CleanUpTags() public static method

Deletes all unused tags from the DB
public static CleanUpTags ( ) : int
return int

CommitTransaction() public static method

Commits the current transaction
public static CommitTransaction ( ) : int
return int

Connect() public static method

Opens a connection to the database and imports any previous Manga DB's if possible
public static Connect ( ) : bool
return bool

ContainsEntry() public static method

Returns whether the entry exists in the DB
public static ContainsEntry ( string Artist, string Title ) : bool
Artist string The artist's name
Title string The title of the maga
return bool

DeleteManga() public static method

Deletes an entry from the database
public static DeleteManga ( int mangaID ) : bool
mangaID int The ID of the record to be deleted
return bool

DeleteTag() public static method

Deletes a tag based on the text passed in
public static DeleteTag ( string TagText ) : int
TagText string The tag(s) to delete
return int

Disconnect() public static method

Vacuum's the DB and closes the connection
public static Disconnect ( bool Recycle = false ) : void
Recycle bool
return void

GetAllManga() public static method

Returns the details of every manga in the database
public static GetAllManga ( string SearchText = null, int MangaID = -1 ) : DataTable
SearchText string The user search parameters to compare against
MangaID int
return System.Data.DataTable

GetArtists() public static method

Returns all the artists in the database
public static GetArtists ( ) : string[]
return string[]

GetDefaultType() public static method

Returns the default manga category
public static GetDefaultType ( ) : string
return string

GetLogContents() public static method

Returns the details of everything logged so far
public static GetLogContents ( ) : DataTable
return System.Data.DataTable

GetManga() public static method

Returns the full details of a specified manga
public static GetManga ( int mangaID ) : DataTable
mangaID int The ID of the record
return System.Data.DataTable

GetMangaDetail() public static method

Returns a single detail of a specified manga
public static GetMangaDetail ( int mangaID, Manga Column ) : string
mangaID int The ID of the record
Column Manga
return string

GetMangaTitle() public static method

Returns the EH formatted title of a Manga
public static GetMangaTitle ( int mangaID ) : string
mangaID int The ID of the record to access
return string

GetSetting() public static method

Returns a setting from the DB
public static GetSetting ( Setting DBSetting ) : object
DBSetting Setting
return object

GetTags() public static method

Returns all the tags in the database
public static GetTags ( ) : string[]
return string[]

GetThumbnail() public static method

Returns the manga's thumbnail
public static GetThumbnail ( int MangaID ) : Image
MangaID int
return Image

GetTypes() public static method

Returns all the manga types in the database
public static GetTypes ( ) : string[]
return string[]

HasThumbnail() public static method

Returns true if the entry has a thumbnail for it
public static HasThumbnail ( int MangaID ) : bool
MangaID int The ID of the record
return bool

IsConnected() public static method

Returns whether or not the DB connection is currently open
public static IsConnected ( ) : bool
return bool

LogMessage() public static method

Logs exception details to the DB to support future debugging
public static LogMessage ( Exception exception, EventType eventType, object Source = null ) : bool
exception System.Exception The exception that occurred
eventType EventType The type of event being logged
Source object
return bool

LogMessage() public static method

Logs exception details to the DB to support future debugging
public static LogMessage ( string LogMessage, EventType eventType, object Source = null ) : bool
LogMessage string Coder explanation of the situation
eventType EventType The type of event being logged
Source object The object that caused the error
return bool

RollbackTransaction() public static method

Rollbacks the current transaction
public static RollbackTransaction ( ) : int
return int

SaveManga() public static method

Insert or updates a manga
public static SaveManga ( string Artist, string Title, System.DateTime PublishedDate, string Tags = null, string Location = null, decimal Pages, int PageReadCount = -1, string Type = null, decimal Rating, string Description = null, string URL = null, bool ReadManga = false, int MangaID = -1 ) : int
Artist string The name of the artist
Title string The title of the manga
PublishedDate System.DateTime The date the manga was published to EH
Tags string The comma-delimited tags
Location string The local filepath
Pages decimal The number of pages
PageReadCount int The last page read
Type string The type of the manga
Rating decimal The decimal rating
Description string User comments
URL string The source URL of the gallery
ReadManga bool Whether the manga has been read
MangaID int If passed through, attempts to update the indicated record
return int

SaveReadProgress() public static method

Stores the last page read of a manga and updates it's read status
public static SaveReadProgress ( int MangaID, int PageReadCount = -1 ) : int
MangaID int The ID of the manga to update
PageReadCount int The last page read
return int

SaveThumbnail() public static method

Saves a thumbnail image to the database
public static SaveThumbnail ( int MangaID, Image image ) : bool
MangaID int The manga the image is for
image Image The cover thumbnail to save
return bool

UpdateSetting() public static method

Update the indicated setting
public static UpdateSetting ( Setting DBSetting, object setting ) : bool
DBSetting Setting The name of the setting to update
setting object The new value
return bool

VacuumDatabase() public static method

Runs the vacuum command on the database to reduce filesize if possible
public static VacuumDatabase ( ) : bool
return bool