C# 클래스 Shared.Data.DatabaseImplementation

This is the implementation of the database with all queries, commands, etc.
상속: IDisposable
파일 보기 프로젝트 열기: sealuzh/PersonalAnalytics 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
CurrentDatabaseDumpFile string

공개 메소드들

메소드 설명
Connect ( ) : void

Opens a connection to the database with the current database save path

CreateLogTable ( ) : void

Creates a table for the log inputs (if it doesn't yet exist)

CreateSettingsTable ( ) : void

Creates a table for the settings (keys) (if it doesn't yet exist)

CreateTimeZoneTable ( ) : void

Creates a table for the time zone (if it doesn't yet exist)

DatabaseImplementation ( string dbFilePath ) : System
Disconnect ( ) : void

Closes the connection to the database.

Dispose ( ) : void
ExecuteDefaultQuery ( string query ) : int

Executes a query (given as parameter). Also logs the query.

ExecuteQueryWithTransaction ( List commands ) : void
ExecuteReadQuery ( string query ) : DataTable

Executes a query (given as a parameter).

ExecuteScalar ( string query ) : int

Executes a query scalar. Return 1 in case of an entry, or 0 in case of no entry or an error

ExecuteScalar2 ( string query ) : object

Executes a query scalar and returns null if there was an error (or no entry) used for settings. Somehow strange?

GetDateFilteringStringForQuery ( VisType type, DateTimeOffset date, string datePropertyName = "time" ) : string
GetDbPragmaVersion ( ) : int

Get the actual database version

GetLastTimeZoneEntry ( ) : TimeZoneInfo
GetSettingsBool ( string key, bool byDefault ) : bool

Gets the stored setting value for a given key

GetSettingsDate ( string key, DateTimeOffset byDefault ) : DateTimeOffset
GetSettingsInt ( string key, int byDefault ) : int

Gets the stored setting value for a given key

GetSettingsString ( string key, string byDefault ) : string

gets the stored setting value for a given key

GetUserWorkEnd ( DateTimeOffset date ) : DateTime
GetUserWorkStart ( DateTimeOffset date ) : DateTime
HasSetting ( string key ) : bool

Checks if a settings for a given key is stored. returns false in case of an error

LogError ( string message ) : void

Inserts the message (given as a parameter) into the log-database-table (flag: Error).

LogErrorUnknown ( string tracker ) : void

Inserts an unknown error with the name of the tracker into the log-database-table (flag: Error). Also logs the query.

LogInfo ( string message ) : void

Inserts the message (given as a parameter) into the log-database-table (flag: Info). Also logs the query.

LogTimeZoneChange ( TimeZoneInfo currentTimeZone ) : void
LogWarning ( string message ) : void

Inserts the message (given as a parameter) into the log-database-table (flag: Warning). Also logs the query.

Q ( bool str ) : string

Q is the James-Bond guy. But for bools.

Q ( int str ) : string

Q is the James-Bond guy. But for ints.

Q ( long str ) : string

Q is the James-Bond guy. But for longs.

Q ( string str ) : string

Q is the James-Bond guy. Improves the string characters not to mess it up in the query string.

QDate ( DateTime dateTime ) : string

Formats and magicifies a datetime '%Y-%m-%d'

QTime ( DateTime dateTime ) : string

Formats and magicifies a datetime '%Y-%m-%d %H:%M:%S'

Reconnect ( ) : void
SetSettings ( string key, bool value ) : void

Saves a setting with a given key or value. Inserts new entry if nothing is yet stored or updates the value.

SetSettings ( string key, string value ) : void

Saves a setting with a given key or value. Inserts new entry if nothing is yet stored or updates the value.

UpdateDbPragmaVersion ( int version ) : void

Update the database version when an existing table changes

비공개 메소드들

메소드 설명
WriteQueryToLog ( string query, bool force = false ) : void

Logs the query if the global setting allows it and it's not enforced my the calling method.

메소드 상세

Connect() 공개 메소드

Opens a connection to the database with the current database save path
public Connect ( ) : void
리턴 void

CreateLogTable() 공개 메소드

Creates a table for the log inputs (if it doesn't yet exist)
public CreateLogTable ( ) : void
리턴 void

CreateSettingsTable() 공개 메소드

Creates a table for the settings (keys) (if it doesn't yet exist)
public CreateSettingsTable ( ) : void
리턴 void

CreateTimeZoneTable() 공개 메소드

Creates a table for the time zone (if it doesn't yet exist)
public CreateTimeZoneTable ( ) : void
리턴 void

DatabaseImplementation() 공개 메소드

public DatabaseImplementation ( string dbFilePath ) : System
dbFilePath string
리턴 System

Disconnect() 공개 메소드

Closes the connection to the database.
public Disconnect ( ) : void
리턴 void

Dispose() 공개 메소드

public Dispose ( ) : void
리턴 void

ExecuteDefaultQuery() 공개 메소드

Executes a query (given as parameter). Also logs the query.
public ExecuteDefaultQuery ( string query ) : int
query string
리턴 int

ExecuteQueryWithTransaction() 공개 메소드

public ExecuteQueryWithTransaction ( List commands ) : void
commands List
리턴 void

ExecuteReadQuery() 공개 메소드

Executes a query (given as a parameter).
public ExecuteReadQuery ( string query ) : DataTable
query string
리턴 DataTable

ExecuteScalar() 공개 메소드

Executes a query scalar. Return 1 in case of an entry, or 0 in case of no entry or an error
public ExecuteScalar ( string query ) : int
query string
리턴 int

ExecuteScalar2() 공개 메소드

Executes a query scalar and returns null if there was an error (or no entry) used for settings. Somehow strange?
public ExecuteScalar2 ( string query ) : object
query string
리턴 object

GetDateFilteringStringForQuery() 공개 메소드

public GetDateFilteringStringForQuery ( VisType type, DateTimeOffset date, string datePropertyName = "time" ) : string
type VisType
date DateTimeOffset
datePropertyName string
리턴 string

GetDbPragmaVersion() 공개 메소드

Get the actual database version
public GetDbPragmaVersion ( ) : int
리턴 int

GetLastTimeZoneEntry() 공개 메소드

public GetLastTimeZoneEntry ( ) : TimeZoneInfo
리턴 TimeZoneInfo

GetSettingsBool() 공개 메소드

Gets the stored setting value for a given key
public GetSettingsBool ( string key, bool byDefault ) : bool
key string
byDefault bool
리턴 bool

GetSettingsDate() 공개 메소드

public GetSettingsDate ( string key, DateTimeOffset byDefault ) : DateTimeOffset
key string
byDefault DateTimeOffset
리턴 DateTimeOffset

GetSettingsInt() 공개 메소드

Gets the stored setting value for a given key
public GetSettingsInt ( string key, int byDefault ) : int
key string
byDefault int
리턴 int

GetSettingsString() 공개 메소드

gets the stored setting value for a given key
public GetSettingsString ( string key, string byDefault ) : string
key string
byDefault string
리턴 string

GetUserWorkEnd() 공개 메소드

public GetUserWorkEnd ( DateTimeOffset date ) : DateTime
date DateTimeOffset
리턴 DateTime

GetUserWorkStart() 공개 메소드

public GetUserWorkStart ( DateTimeOffset date ) : DateTime
date DateTimeOffset
리턴 DateTime

HasSetting() 공개 메소드

Checks if a settings for a given key is stored. returns false in case of an error
public HasSetting ( string key ) : bool
key string
리턴 bool

LogError() 공개 메소드

Inserts the message (given as a parameter) into the log-database-table (flag: Error).
public LogError ( string message ) : void
message string
리턴 void

LogErrorUnknown() 공개 메소드

Inserts an unknown error with the name of the tracker into the log-database-table (flag: Error). Also logs the query.
public LogErrorUnknown ( string tracker ) : void
tracker string
리턴 void

LogInfo() 공개 메소드

Inserts the message (given as a parameter) into the log-database-table (flag: Info). Also logs the query.
public LogInfo ( string message ) : void
message string
리턴 void

LogTimeZoneChange() 공개 메소드

public LogTimeZoneChange ( TimeZoneInfo currentTimeZone ) : void
currentTimeZone TimeZoneInfo
리턴 void

LogWarning() 공개 메소드

Inserts the message (given as a parameter) into the log-database-table (flag: Warning). Also logs the query.
public LogWarning ( string message ) : void
message string
리턴 void

Q() 공개 메소드

Q is the James-Bond guy. But for bools.
public Q ( bool str ) : string
str bool
리턴 string

Q() 공개 메소드

Q is the James-Bond guy. But for ints.
public Q ( int str ) : string
str int
리턴 string

Q() 공개 메소드

Q is the James-Bond guy. But for longs.
public Q ( long str ) : string
str long
리턴 string

Q() 공개 메소드

Q is the James-Bond guy. Improves the string characters not to mess it up in the query string.
public Q ( string str ) : string
str string
리턴 string

QDate() 공개 메소드

Formats and magicifies a datetime '%Y-%m-%d'
public QDate ( DateTime dateTime ) : string
dateTime DateTime
리턴 string

QTime() 공개 메소드

Formats and magicifies a datetime '%Y-%m-%d %H:%M:%S'
public QTime ( DateTime dateTime ) : string
dateTime DateTime
리턴 string

Reconnect() 공개 메소드

public Reconnect ( ) : void
리턴 void

SetSettings() 공개 메소드

Saves a setting with a given key or value. Inserts new entry if nothing is yet stored or updates the value.
public SetSettings ( string key, bool value ) : void
key string
value bool
리턴 void

SetSettings() 공개 메소드

Saves a setting with a given key or value. Inserts new entry if nothing is yet stored or updates the value.
public SetSettings ( string key, string value ) : void
key string
value string
리턴 void

UpdateDbPragmaVersion() 공개 메소드

Update the database version when an existing table changes
public UpdateDbPragmaVersion ( int version ) : void
version int
리턴 void

프로퍼티 상세

CurrentDatabaseDumpFile 공개적으로 프로퍼티

public string CurrentDatabaseDumpFile
리턴 string