示例#1
0
 public DBColumnGroupList(DBTable table) : base(table)
 {
 }
示例#2
0
 public DBComparer(DBTable table, string column, ListSortDirection direction = ListSortDirection.Ascending)
     : this(table, table.ParseColumn(column), column, direction)
 {
 }
示例#3
0
 public override void Dispose()
 {
     Table = null;
     base.Dispose();
 }
示例#4
0
 public IEnumerable <DBColumn> GetByReference(DBTable table)
 {
     return(Select(DBColumn.ReferenceTableInvoker <T> .Instance, CompareType.Equal, table.Name));
 }
示例#5
0
 public DBTableView()
     : this(DBTable.GetTable <T>(null, false), (QParam)null, DBViewKeys.None, DBStatus.Empty)
 {
 }
示例#6
0
 public DBTableItemList(DBTable table) : base()
 {
     Table = table;
 }
示例#7
0
 public DBIndexList(DBTable table) : base(table)
 {
 }
示例#8
0
 public DBForeignList(DBTable table) : base(table)
 {
     Indexes.Add(DBForeignKey.ReferenceNameInvoker.Instance);
     Indexes.Add(DBForeignKey.ReferenceTableNameInvoker.Instance);
     Indexes.Add(DBForeignKey.PropertyInvoker.Instance);
 }
示例#9
0
 public DBForeignKey(DBColumn column, DBTable value) : this()
 {
     Column    = column;
     Reference = value.PrimaryKey;
 }
示例#10
0
 public override void FormatInsertSequence(StringBuilder command, DBTable table, DBItem row)
 {
     throw new NotSupportedException();
 }
示例#11
0
        public static DBCommand Build(DBTable table, string procName, DBCommandTypes type, IEnumerable <DBColumn> columns = null)
        {
            if (table.PrimaryKey == null && (type == DBCommandTypes.Delete || type == DBCommandTypes.Update))
            {
                return(null);
            }
            if (columns == null)
            {
                columns = table.Columns;
            }
            string commandText = procName;
            string prefix      = table.Schema.System.ParameterPrefix;

            CommandType ctype = CommandType.StoredProcedure;

            if (string.IsNullOrEmpty(procName))
            {
                ctype       = CommandType.Text;
                commandText = table.Schema.System.FormatCommand(table, type, null, columns);
            }
            var command = new DBCommand(commandText, ctype);

            if (type == DBCommandTypes.Delete)
            {
                command.Parameters.Add(new DBCommandParameter(table.PrimaryKey, prefix)
                {
                    Direction = ParameterDirection.Input
                });
            }
            else
            {
                DBCommandParameter paramId = null;
                if (table.PrimaryKey != null)
                {
                    paramId = new DBCommandParameter(table.PrimaryKey, prefix)
                    {
                        Direction = ParameterDirection.Input
                    };

                    if (type == DBCommandTypes.Insert || type == DBCommandTypes.InsertSequence)
                    {
                        command.Parameters.Add(paramId);
                    }
                    //else if (type == DBCommandTypes.InsertSequence)
                    //{
                    //command.Parameters.Add(paramId);
                    //paramId.Direction = ParameterDirection.InputOutput;
                    //}
                }
                foreach (var column in columns)
                {
                    if (column.ColumnType == DBColumnTypes.Default && column != table.PrimaryKey)
                    {
                        var prm = new DBCommandParameter(column, prefix);
                        if (ctype == CommandType.Text)
                        {
                            prm.Direction = ParameterDirection.Input;
                        }
                        command.Parameters.Add(prm);
                    }
                }
                if (paramId != null && type == DBCommandTypes.Update)
                {
                    command.Parameters.Add(paramId);
                }
            }
            return(command);
        }
示例#12
0
 public DBTableView(DBTable <T> table, string defaultFilter, DBViewKeys mode = DBViewKeys.None, DBStatus statusFilter = DBStatus.Empty)
     : this(table, !string.IsNullOrEmpty(defaultFilter) ? new QParam(table, defaultFilter) : null, mode, statusFilter)
 {
 }
示例#13
0
 public DBTableView(QParam defaultFilter, DBViewKeys mode = DBViewKeys.None, DBStatus statusFilter = DBStatus.Empty)
     : this(DBTable.GetTable <T>(null, false), defaultFilter, mode, statusFilter)
 {
 }
示例#14
0
 public QTable(DBTable table, string alias = null)
 {
     Table      = table;
     this.alias = alias;
 }
示例#15
0
 public override void Initialize(Type type)
 {
     BaseTable = DBTable.GetTableAttribute(BaseType);
     base.Initialize(type);
 }
示例#16
0
 public DBConstraintList(DBTable table) : base(table)
 {
     Indexes.Add(DBConstraintColumnNameInvoker <T> .Instance);
 }
示例#17
0
 public DBLogTable(DBTable table)
 {
     BaseTable = table;
 }
示例#18
0
 public IEnumerable <DBForeignKey> GetByReference(DBTable reference)
 {
     return(Select(DBForeignKey.ReferenceTableNameInvoker.Instance, CompareType.Equal, reference.FullName));
 }
示例#19
0
 public static Dictionary <DBColumn, int> WriteColumns(BinaryWriter bw, DBTable tble)
 {
     return(WriteColumns(bw, tble.Columns));
 }