mirror of
https://bitbucket.org/anguist/ntpa
synced 2025-10-05 18:41:13 +00:00
SQL optimization and related stuff
This commit is contained in:
@ -73,6 +73,11 @@ namespace Ntp.Data.Provider
|
||||
return new MySqlParameter(name, value);
|
||||
}
|
||||
|
||||
public override string DateAddMinutes(string dateColumn, string minuteColumn)
|
||||
{
|
||||
return $"{dateColumn} + interval {minuteColumn} minute";
|
||||
}
|
||||
|
||||
public override string PrepareCheckTableSql(string table)
|
||||
{
|
||||
return PrepareSql(string.Format(CheckTableSql, Config.Name, table));
|
||||
|
@ -107,6 +107,11 @@ namespace Ntp.Data.Provider
|
||||
return new NpgsqlParameter(name, value);
|
||||
}
|
||||
|
||||
public override string DateAddMinutes(string dateColumn, string minuteColumn)
|
||||
{
|
||||
return $"{dateColumn} + {minuteColumn} * INTERVAL '1 minute'";
|
||||
}
|
||||
|
||||
public override string PrepareCheckTableSql(string table)
|
||||
{
|
||||
return PrepareSql(string.Format(CheckTableSql, Config.Name, table));
|
||||
@ -150,14 +155,7 @@ namespace Ntp.Data.Provider
|
||||
if (Config.ConnectionTimeout.HasValue)
|
||||
b.Append($"Timeout={Config.ConnectionTimeout.Value};");
|
||||
|
||||
if (Config.EnableSsl)
|
||||
{
|
||||
b.Append(@"SslMode=Require;");
|
||||
}
|
||||
else
|
||||
{
|
||||
b.Append(@"SslMode=Disable;");
|
||||
}
|
||||
b.Append(Config.EnableSsl ? @"SslMode=Require;" : @"SslMode=Disable;");
|
||||
|
||||
if (Config.Protocol.HasValue)
|
||||
b.Append($"Protocol={Config.Protocol.Value};");
|
||||
|
@ -58,6 +58,8 @@ namespace Ntp.Data.Provider
|
||||
|
||||
public abstract void CreateDatabase();
|
||||
|
||||
public abstract string DateAddMinutes(string dateColumn, string minuteColumn);
|
||||
|
||||
public static void Initialize(IDatabaseConfiguration factoryConfiguration)
|
||||
{
|
||||
Config = factoryConfiguration;
|
||||
|
Reference in New Issue
Block a user