Files
marechai/Marechai.Database/IDbCore.cs

68 lines
2.6 KiB
C#
Raw Normal View History

2018-04-12 10:20:31 +01:00
/******************************************************************************
2020-02-10 01:52:56 +00:00
// MARECHAI: Master repository of computing history artifacts information
2018-04-12 10:20:31 +01:00
// ----------------------------------------------------------------------------
//
// Filename : IDbCore.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Defines database interface using System.Data.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
2020-02-10 03:05:39 +00:00
// Copyright © 2003-2020 Natalia Portillo
2018-04-12 10:20:31 +01:00
*******************************************************************************/
2018-04-12 11:50:02 +01:00
2018-04-12 10:20:31 +01:00
using System.Data;
2018-04-12 10:05:42 +01:00
2020-02-10 02:10:18 +00:00
namespace Marechai.Database
2018-04-12 10:05:42 +01:00
{
2018-04-12 11:50:02 +01:00
/// <summary>Interface to database</summary>
2018-04-12 10:05:42 +01:00
public interface IDbCore
{
2018-04-12 11:50:02 +01:00
/// <summary>Database operations</summary>
2018-04-12 10:05:42 +01:00
Operations Operations { get; }
2018-04-12 11:50:02 +01:00
/// <summary>Last inserted row's ID</summary>
2018-04-12 10:05:42 +01:00
long LastInsertRowId { get; }
2018-04-12 11:50:02 +01:00
/// <summary>
/// Opens an existing database
/// </summary>
/// <param name="server">Server</param>
/// <param name="user">User</param>
/// <param name="database">Database name</param>
/// <param name="password">Password</param>
/// <param name="port">Port</param>
/// <returns><c>true</c> if database opened correctly, <c>false</c> otherwise</returns>
2018-04-12 10:05:42 +01:00
bool OpenDb(string server, string user, string database, string password, ushort port);
2018-04-12 11:50:02 +01:00
/// <summary>
/// Closes the database
/// </summary>
2018-04-12 10:05:42 +01:00
void CloseDb();
2018-04-12 11:50:02 +01:00
/// <summary>
/// Gets a data adapter for the opened database
/// </summary>
/// <returns>Data adapter</returns>
2018-04-12 10:05:42 +01:00
IDbDataAdapter GetNewDataAdapter();
2018-04-15 17:51:07 +01:00
bool TableExists(string tableName);
2018-04-12 10:05:42 +01:00
}
}