Beispiel #1
0
        private static void ValidateColumn(
            InformationSchemaColumn column,
            string name,
            string type,
            bool isNullable,
            byte?numericPrecision = null,
            int?numericScale      = null,
            int?charMaxLength     = null)
        {
            if (column == null)
            {
                throw new ArgumentNullException(nameof(column));
            }

            column.COLUMN_NAME.Should().Be(name);
            column.DATA_TYPE.Should().Be(type);
            column.IS_NULLABLE.Should().Be(isNullable ? "YES" : "NO");

            if (numericPrecision.HasValue)
            {
                column.NUMERIC_PRECISION.Should().Be(numericPrecision.Value);
            }

            if (numericScale.HasValue)
            {
                column.NUMERIC_SCALE.Should().Be(numericScale.Value);
            }

            if (charMaxLength.HasValue)
            {
                column.CHARACTER_MAXIMUM_LENGTH.Should().Be(charMaxLength.Value);
            }
        }
Beispiel #2
0
        private void A_tabela_de_log_deve_ter_criar_esse_campo_tambem()
        {
            var infomationColumn = new InformationSchemaColumn {
                DBName = _tableWithlog.DBName
            };

            infomationColumn.GetByKey(_tableWithlog.TableName + "Log", newFeldAdd.Name).Should().Be.True();;
        }
Beispiel #3
0
        private void A_tabela_de_log_deve_ser_criada()
        {
            var infosSchema = new InformationSchemaColumn {
                DBName = _tableWithlog.DBName
            };

            infosSchema.GetByKey("FakeLog", TableAdapterLog.FieldsName.InstanceLog)
            .Should().Be.True();
        }
        private Boolean ExistField(string field)
        {
            var infoTable = new InformationSchemaColumn();

            infoTable.SetConnection(Connection.Instance);
            infoTable.DBName = _tableLog.DBName;

            return(infoTable.GetByKey(_tableLog.TableName, field));
        }
Beispiel #5
0
        private void CreateUserCacheTable()
        {
            InformationSchemaColumn infoSchema = new InformationSchemaColumn();
            UserCache myUser = new UserCache();

            infoSchema.DBName = myUser.DBName;

            if (!infoSchema.GetByKey(UserCache.Definition.TableName, UserCache.FieldsName.ID))
            {
                myUser.Create();
            }
        }
Beispiel #6
0
        /// <summary>
        /// Cria a tabela caso a mesma não exista
        /// </summary>
        private void CreateNotExists()
        {
            var table  = CreateUserControlProperty();
            var schema = new InformationSchemaColumn()
            {
                DBName = db.DataBaseName
            };

            if (!schema.GetByKey(table.TableName, table.Collumns.First().Name))
            {
                table.Create();
            }
        }
        private bool ExistTable()
        {
            SetTableAndDbNameLogFor(_tableLogBase);

            var infoTable = new InformationSchemaColumn();

            infoTable.SetConnection(Connection.Instance);
            infoTable.DBName = _tableLog.DBName;

            var tableQuery = new TableQuery(infoTable);

            tableQuery.Where.Add(
                new QueryParam(infoTable.Collumns[InformationSchemaColumn.FieldsName.TableName],
                               _tableLog.TableName));

            var list = infoTable.FillCollection <InformationSchemaColumn>(tableQuery);

            return(!list.IsEmpty());
        }