PeanutButter
Loading...
Searching...
No Matches
PeanutButter.TempDb.MySql.Connector.TempDBMySql Class Reference

Provides the TempDB implementation for MySql, using MySql.Data as the connector library. More...

Inheritance diagram for PeanutButter.TempDb.MySql.Connector.TempDBMySql:
PeanutButter.TempDb.MySql.Base.TempDBMySqlBase< MySqlConnection >

Public Member Functions

 TempDBMySql ()
 Constructs a TempDbMySql.
 
 TempDBMySql (params string[] creationScripts)
 Construct a TempDbMySql with zero or more creation scripts and default options.
 
 TempDBMySql (TempDbMySqlServerSettings settings, params string[] creationScripts)
 Create a TempDbMySql instance with provided options and zero or more creation scripts.
 
 TempDBMySql (TempDbMySqlServerSettings settings, Action< object > beforeInit, params string[] creationScripts)
 Create a TempDbMySql instance with provided options, an action to run before initializing and zero or more creation scripts.
 
- Public Member Functions inherited from PeanutButter.TempDb.MySql.Base.TempDBMySqlBase< MySqlConnection >
 TempDBMySqlBase (params string[] creationScripts)
 Construct a TempDbMySql with zero or more creation scripts and default options.
 
 TempDBMySqlBase (TempDbMySqlServerSettings settings, params string[] creationScripts)
 Create a TempDbMySql instance with provided options and zero or more creation scripts.
 
 TempDBMySqlBase (TempDbMySqlServerSettings settings, Action< object > beforeInit, params string[] creationScripts)
 Create a TempDbMySql instance with provided options, an action to run before initializing and zero or more creation scripts.
 
string Snapshot ()
 Snapshots the database and returns the path on disk.
 
string Snapshot (string toNewFolder)
 Snapshots the database to the provided path and returns the path on disk.
 
string Snapshot (string toNewFolder, bool restartServerAfterwards)
 
void UseDefaultUser ()
 Switch to the default tempdb_user user.
 
void UseUser (string user)
 Selects the user to be used when calling OpenConnection or reading the connection string. The user must already exist, otherwise this will throw. Use CreateUser to create a user.
 
bool UseSuperUser ()
 Switch to the root user.
 
void CloseAllConnections ()
 
override string DumpSchema ()
 
void SwitchToSchema (string schema)
 Switches to the provided schema name for connections from now on. Creates the schema if not already present.
 
void CreateSchemaIfNotExists (string schema)
 
void CreateUser (string user, string password, params string[] forSchemas)
 
void GrantAllPermissionsFor (string user, string schema, string host)
 
string Escape (string other)
 Escapes back-ticks in mysql sql strings.
 
string Quote (string other)
 
void Execute (string sql)
 Executes arbitrary sql on the current schema.
 
IEnumerable< Dictionary< string, object > > ExecuteReader (string sql)
 
override void Dispose ()
 
void Restart ()
 
override DbConnection OpenConnection ()
 

Protected Member Functions

override string GenerateConnectionString ()
 Generates the connection string to use for clients wishing to connect to this temp instance.
 
override int FetchCurrentConnectionCount ()
 
- Protected Member Functions inherited from PeanutButter.TempDb.MySql.Base.TempDBMySqlBase< MySqlConnection >
override void CreateDatabase ()
 
string DetermineRootPassword ()
 
int FetchCurrentConnectionCount (IDbConnection conn)
 
virtual bool IsMyInstance (Guid? assimilatedInstanceId)
 
bool CanConnect ()
 
virtual int FindRandomOpenPort ()
 

Additional Inherited Members

- Static Public Attributes inherited from PeanutButter.TempDb.MySql.Base.TempDBMySqlBase< MySqlConnection >
static int DefaultStartupMaxWaitSeconds
 The maximum amount of time to wait for a mysqld process to be listening for connections after starting up. Defaults to 45 seconds, but left static so consumers can tweak the value as required.
 
static int MaxStartupAttempts
 Maximum number of times that TempDBMySql will automatically re-attempt initial start. This may be useful in the case where MySql isn't starting up but also isn't logging anything particularly useful about why it isn't starting up. Defaults to 5, but left as a static so consumers can tweak the value as required.
 
const string DEFAULT_USER
 
- Static Protected Member Functions inherited from PeanutButter.TempDb.MySql.Base.TempDBMySqlBase< MySqlConnection >
static void BeforeInit (TempDBMySqlBase< T > self, Action< object > beforeInit, TempDbMySqlServerSettings settings)
 
- Protected Attributes inherited from PeanutButter.TempDb.MySql.Base.TempDBMySqlBase< MySqlConnection >
string SchemaName
 
- Properties inherited from PeanutButter.TempDb.MySql.Base.TempDBMySqlBase< MySqlConnection >
string BootstrappedFromTemplateFolder [get, protected set]
 
string ServerCommandline [get]
 
static int MaxSecondsToWaitForMySqlToStart [get]
 
string ConfigFilePath [get, set]
 After the server has been set up and started, this will reflect the absolute path to the configuration file for the server.
 
string CurrentUser [get, set]
 
bool VerboseLoggingEnabled [get, set]
 
TempDbMySqlServerSettings Settings [get]
 Set to true to see trace logging about discovery of a port to instruct mysqld to bind to.
 
int? ServerProcessId [get]
 
string ServerProcessCommand [get]
 
int Port [get, protected set]
 
bool RootPasswordSet [get]
 
Guid InstanceId [get]
 
MySqlVersionInfo MySqlVersion [get]
 
bool TemplateFolderIsShared [get]
 
bool IsRunning [get]
 
string DataDir [get]
 

Detailed Description

Provides the TempDB implementation for MySql, using MySql.Data as the connector library.

Constructor & Destructor Documentation

◆ TempDBMySql() [1/3]

PeanutButter.TempDb.MySql.Connector.TempDBMySql.TempDBMySql ( params string[]  creationScripts)

Construct a TempDbMySql with zero or more creation scripts and default options.

Parameters
creationScripts

◆ TempDBMySql() [2/3]

PeanutButter.TempDb.MySql.Connector.TempDBMySql.TempDBMySql ( TempDbMySqlServerSettings  settings,
params string[]  creationScripts 
)

Create a TempDbMySql instance with provided options and zero or more creation scripts.

Parameters
settings
creationScripts

◆ TempDBMySql() [3/3]

PeanutButter.TempDb.MySql.Connector.TempDBMySql.TempDBMySql ( TempDbMySqlServerSettings  settings,
Action< object >  beforeInit,
params string[]  creationScripts 
)

Create a TempDbMySql instance with provided options, an action to run before initializing and zero or more creation scripts.

Parameters
settings
beforeInit
creationScripts

Member Function Documentation

◆ GenerateConnectionString()

override string PeanutButter.TempDb.MySql.Connector.TempDBMySql.GenerateConnectionString ( )
protected

Generates the connection string to use for clients wishing to connect to this temp instance.

Returns

The documentation for this class was generated from the following file: