constraints

Oracle Unique Constraint based on column value

旧时模样 提交于 2019-11-29 21:02:56
问题 I have the following unique constraint dup_Checklist_QNum UNIQUE (QUESTION_NO, IS_ACTIVE) I am trying to prevent two questions having the same question number while being active (IS_ACTIVE value = 1). All seemed fine until I had to rev a question for the second time. QUESTION_NO=1, TEXT="Have you..", REV=1, IS_ACTIVE=0 QUESTION_NO=1, TEXT="Have you..", REV=2, IS_ACTIVE=0 <-- This should be ok but constraint was violated QUESTION_NO=1, TEXT="Have you..", REV=3, IS_ACTIVE=1 QUESTION_NO=1, TEXT=

How can I change constraints priority in run time

安稳与你 提交于 2019-11-29 20:23:22
I have a view which has dynamic height and I am trying to change this view height priority in run time. Here is my part of code; if (index == 0) { surveyViewHeightConstraint.constant = 0; surveyViewHeightConstraint.priority = 1000; } else if (index == 1) { surveyViewHeightConstraint.constant = 163; surveyViewHeightConstraint.priority = 500; } I am changing index with a button action. When I run this code, I am getting this error: *** Assertion failure in -[NSLayoutConstraint setPriority:], /SourceCache/Foundation/Foundation-1141.1/Layout.subproj/NSLayoutConstraint.m:174 What is my mistake in

Remove all constraints affecting a UIView

时间秒杀一切 提交于 2019-11-29 19:31:13
I have a UIView which is placed on the screen via several constraints. Some of the constraints are owned by the superview, others are owned by other ancestors (e.g. perhaps the view property of a UIViewController). I want to remove all of these old constraints, and place it somewhere new using new constraints. How can I do this without creating an IBOutlet for every single constraint and having to remember which view owns said constraint? To elaborate, the naive approach would be to create a bunch of IBOutlets for each of the constraints, and would then involve calling code such as: [viewA

How to manage the gap between two views in auto layout

百般思念 提交于 2019-11-29 17:58:01
I am using auto layout for my ViewController I know how to define the gap between two views using constraints programmatically. What I want to do now is when the screen size increase, increase the gap also. Because my UIViews are positioned properly in iphone 4s and 5s but in 6 and 6 plus they are positioned in a small area of the screen. I know adding multiplier we can set the aspect ratio of a view but, how to increase the gap between 2 views when the screen hight increase. UPDATE Let say this image,, there is a logo above this please login label. This is my verticle position constraint V:|

Getting an ORA - 00907 error on the following at ON UPDATE

為{幸葍}努か 提交于 2019-11-29 17:01:26
When implementing my oracle database I receive an ORA-00907 error on line 8 at ON UPDATE. Its complaining about right parenthesis but I don't see this error anywhere. whats my issue? CREATE TABLE Result ( Rid number, Hid number, Jid number, Jweight number(5), Place number(3), CONSTRAINT Result_PK PRIMARY KEY(Rid, Hid, Jid), CONSTRAINT ResultRACE_FK FOREIGN KEY(Rid) REFERENCES Race(Rid) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT ResultHORSE_FK FOREIGN KEY(Hid) REFERENCES Horse(Hid) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT ResultJOCKEY_FK FOREIGN KEY(Jid) REFERENCES Jockey(Jid) ON

Why is some ordering enforced in generic parameter constraints?

落爺英雄遲暮 提交于 2019-11-29 16:36:03
问题 When defining a generic type parameter's constraints, we have to put class() at the front and new() at the end, for example. Why is this, why can't I put my constraints in any order? Are there any other restrictions on ordering besides class / struct first, new() at the end? Example: protected T Clone<T>() where T : class, ICopyable<T>, new() 回答1: There's no particular reason why that order was chosen. The chosen order goes from more general to more specific, which I suppose is a reasonably

How to correctly handle dates in queries constraints

蓝咒 提交于 2019-11-29 16:31:54
I am currently using the following query to get all the inspections done on june 2010: select inspections.name from inspections where to_char(inspections.insp_date, 'YYYY') = 2010 and to_char(inspections.insp_date, 'MM') = 06; but this feels kinda awkward. Wouldn't there be a better way of doing this? Looking at http://infolab.stanford.edu/~ullman/fcdb/oracle/or-time.html it doesn't seem so. I am using Oracle, if it makes a difference. Thanks I like to use range comparison when possible since this can be used for index-scan by the optimizer: select inspections.name from inspections where

How to add constraints on inherited properties in a grails domain sub-class

半城伤御伤魂 提交于 2019-11-29 16:21:45
问题 Here's what I'd like to do: class A { String string static constraints = { string(maxSize:100) } } class B extends A { static constraints = { string(url:true) } } So class A should have some constraints and B should have the same plus additional constraints on the same property. I couldn't get that to work though and I can imagine that it would clash with the Table-per-Hierarchy concept. So I tried to work around that problem by introducing a Command object with class B's constraints which

How to disable a constraint programatically?

风流意气都作罢 提交于 2019-11-29 15:12:05
How to disable a constraint programatically? I have two constraints, that the priority of one depends for the other. As far as I know the constraints priority can’t change programatically when they are installed (it throw me an error), So the idea is, when X occurs the constraint A is disable and the constraint B is enable, and when Y occur A is enable and B disable IBOutlet weak var constraint_A IBOutlet weak var constraint_B ... func configureViews() { if x { constraint_A.disable = true constraint_B.disable = false } else { constraint_A.disable = false constraint_B.disable = true } } ... The

Changing MySQL primary key when foreign key contraints exist

三世轮回 提交于 2019-11-29 13:34:16
I have two already-existing tables which look (in part) roughly like this: CREATE TABLE parent ( old_pk CHAR(8) NOT NULL PRIMARY KEY ) ENGINE=InnoDB; CREATE TABLE child ( parent_key CHAR(8), FOREIGN KEY (parent_key) REFERENCES parent(old_pk) ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB; I want to add a new auto-incrementing integer id column to parent and use it as the primary key instead, while still keeping old_pk as a unique key and allowing other tables like child to reference it in foreign key contraints. Unfortunately, simply saying ALTER TABLE parent DROP PRIMARY KEY doesn't work