mirror of
https://github.com/fergalmoran/DnsServer.git
synced 2025-12-22 09:29:50 +00:00
QueryLogsMySql: changed driver to MySqlConnector which supports mariadb too. Fixed minor issues.
This commit is contained in:
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
using DnsServerCore.ApplicationCommon;
|
using DnsServerCore.ApplicationCommon;
|
||||||
using MySql.Data.MySqlClient;
|
using MySqlConnector;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -634,10 +634,10 @@ CREATE TABLE IF NOT EXISTS dns_logs
|
|||||||
command.Parameters.AddWithValue("@qname", qname);
|
command.Parameters.AddWithValue("@qname", qname);
|
||||||
|
|
||||||
if (qtype is not null)
|
if (qtype is not null)
|
||||||
command.Parameters.AddWithValue("@qtype", (ushort)qtype);
|
command.Parameters.AddWithValue("@qtype", (short)qtype);
|
||||||
|
|
||||||
if (qclass is not null)
|
if (qclass is not null)
|
||||||
command.Parameters.AddWithValue("@qclass", (ushort)qclass);
|
command.Parameters.AddWithValue("@qclass", (short)qclass);
|
||||||
|
|
||||||
totalEntries = Convert.ToInt64(await command.ExecuteScalarAsync() ?? 0L);
|
totalEntries = Convert.ToInt64(await command.ExecuteScalarAsync() ?? 0L);
|
||||||
}
|
}
|
||||||
@@ -714,10 +714,10 @@ ORDER BY row_num" + (descendingOrder ? " DESC" : "");
|
|||||||
command.Parameters.AddWithValue("@qname", qname);
|
command.Parameters.AddWithValue("@qname", qname);
|
||||||
|
|
||||||
if (qtype is not null)
|
if (qtype is not null)
|
||||||
command.Parameters.AddWithValue("@qtype", (ushort)qtype);
|
command.Parameters.AddWithValue("@qtype", (short)qtype);
|
||||||
|
|
||||||
if (qclass is not null)
|
if (qclass is not null)
|
||||||
command.Parameters.AddWithValue("@qclass", (ushort)qclass);
|
command.Parameters.AddWithValue("@qclass", (short)qclass);
|
||||||
|
|
||||||
await using (DbDataReader reader = await command.ExecuteReaderAsync())
|
await using (DbDataReader reader = await command.ExecuteReaderAsync())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user