/* TShock, a server mod for Terraria Copyright (C) 2011-2017 Nyx Studios (fka. The TShock Team) 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 . */ using MySql.Data.MySqlClient; using System; namespace TShockAPI.DB { public class SqlColumn { //Required public string Name { get; set; } public MySqlDbType Type { get; set; } //Optional /// /// Sets/Gets if it's unique /// public bool Unique { get; set; } /// /// Sets/Gets if it's primary key /// public bool Primary { get; set; } /// /// Sets/Gets if it autoincrements /// public bool AutoIncrement { get; set; } /// /// Sets/Gets if it can be or not null /// public bool NotNull { get; set; } /// /// Sets the default value /// public string DefaultValue { get; set; } /// /// Use on DateTime only, if true, sets the default value to the current date when creating the row. /// public bool DefaultCurrentTimestamp { get; set; } /// /// Length of the data type, null = default /// public int? Length { get; set; } public SqlColumn(string name, MySqlDbType type) : this(name, type, null) { } public SqlColumn(string name, MySqlDbType type, int? length) { Name = name; Type = type; Length = length; } } /// /// Used when a SqlColumn has validation errors. /// [Serializable] public class SqlColumnException : Exception { /// /// Creates a new SqlColumnException with the given message. /// /// public SqlColumnException(string message) : base(message) { } } }