// ===============================================================================
        //                                                                         Execute
        //                                                                         =======
        public override Object Execute(object[] args)
        {
            InternalAbstractAutoHandler handler = CreateAutoHandler();

            handler.Sql = Sql;
            handler.LoggingMessageSqlArgs = args;
            int rows = handler.Execute(args);

            if (IsCheckSingleRowUpdate && rows != 1)
            {
                throw new EntityAlreadyUpdatedException(args[0], rows);
            }
            return(rows);
        }
        // ===============================================================================
        //                                                                         Execute
        //                                                                         =======
        public override Object Execute(object[] args)
        {
            object        bean = args[0];
            IBeanMetaData bmd  = BeanMetaData;

            string[]        propertyNames = PropertyNames;
            IPropertyType[] propertyTypes = CreateTargetPropertyTypes(bmd, bean, propertyNames);
            if (CanExecute(bean, bmd, propertyTypes, propertyNames) == false)
            {
                return(NO_UPDATE);
            }
            InternalAbstractAutoHandler handler = CreateAutoHandler(DataSource, CommandFactory, bmd, propertyTypes);

            handler.Sql = SetupSql(bmd, propertyTypes);
            handler.LoggingMessageSqlArgs = args; // Actually set up this property in the handler again.
            int i = handler.Execute(args);

            if (i < 1)
            {
                throw new NotSingleRowUpdatedRuntimeException(args[0], i);
            }
            return(i);
        }
示例#3
0
        public override object Execute(object[] args)
        {
            Object        bean = args[0];
            IBeanMetaData bmd  = BeanMetaData;

            String[]        propertyNames = PropertyNames;
            IPropertyType[] propertyTypes = CreateTargetPropertyTypes(bmd, bean, propertyNames);
            if (CanExecute(bean, bmd, propertyTypes, propertyNames) == false)
            {
                return(NO_UPDATE);
            }
            InternalAbstractAutoHandler handler = CreateInternalAutoHandler(DataSource, CommandFactory, bmd, propertyTypes);

            handler.Sql = CreateUpdateSql(bmd, propertyTypes, bean);
            int i = handler.Execute(args);

            // [Comment Out]: This statement moved to the handler at DBFlute-0.8.0.
            // if (IsCheckSingleRowUpdate && i < 1) {
            //     throw new NotSingleRowUpdatedRuntimeException(args[0], i);
            // }

            return(i);
        }