constraints

SQL Constraint/trigger - Is it possible to write a constraint that checks “when you Insert a record it must contain one of two fields”?

坚强是说给别人听的谎言 提交于 2019-12-11 01:15:25
问题 Is it possible to have a constraint/trigger on a record being entered that checks if the user has entered at least one of three fields (all of which can be null). For example, I have a database being used to track bugs and new features in other pieces of software. When a bug is discovered a Feature record is created which can have three foreign keys, discoveredID, fixedID or newFeatureID, all three can be null (because it could be a discovered bug, fixed bug or a new feature added to the

Which Oracle view contains all constraints together?

*爱你&永不变心* 提交于 2019-12-11 01:14:38
问题 I'm trying to get CONSTRAINTS from user_objects table like this: select CASE object_type WHEN 'DATABASE LINK' then 'dblinks' WHEN 'FUNCTION' then 'functions' WHEN 'INDEX' then 'indexes' WHEN 'PACKAGE' then 'packages' WHEN 'PROCEDURE' then 'procedures' WHEN 'SEQUENCE' then 'sequences' WHEN 'TABLE' then 'tables' WHEN 'TRIGGER' then 'triggers' WHEN 'VIEW' then 'views' WHEN 'SYNONYM' then 'synonyms' WHEN 'GRANT' then 'grants' WHEN 'CONSTRAINT' then 'constraints' ELSE object_type END||'|'|| CASE

How can I generate integers that satisfy some restrictions?

微笑、不失礼 提交于 2019-12-11 00:37:02
问题 Can anyone give me a hand with techniques to generate integers that satisfy certain restrictions. For example, say I need to generate integers x and y such that 100 > x and y < x + 5 And I don't mean this particular example but some generic techniques to generate integers that satisfy certain conditions. 回答1: Well, that's not that hard: Pick an integer, mayhaps randomly. Check your conditions If one condition fails, back to step 1. If you have multiple integers, such as x and y in your

iOS, Custom Keyboard with Collection View, Constraints Issue

寵の児 提交于 2019-12-10 23:56:52
问题 I am trying to create a custom keyboard for iOS which includes a collection view with images. Currently I am trying without a storyboard(had several issues with the storyboard and it is not easy to describe). So I am just adding the "nextKeyboardButton" (comes by default when adding the new target on XCode), then added another button (switches the icon types on the UICollectionViewCell and finally the UICollectionView . My code: class KeyboardViewController: UIInputViewController,

Is there a javascript or web development library equivalent of ios' auto layout constraints concept?

旧时模样 提交于 2019-12-10 23:28:12
问题 Has anyone seen this done outside of ios development? The auto layout constraint concept is very interesting and could be helpful in responsive web design, possibly? What do you think/any equivalents out there? 回答1: Yes there is, it's called AutoLayout.js https://github.com/IjzerenHein/autolayout.js 回答2: Its called AutolayoutJS. Here read my blog post .This is a combination of material from varied resources. 来源: https://stackoverflow.com/questions/34367111/is-there-a-javascript-or-web

Type Parameter Constraints - no generics (or nearest offer!)

折月煮酒 提交于 2019-12-10 23:11:50
问题 I am thinking what I want to do is impossible but thought I would ask anyway. I am thinking of implementing some kind of custom conversion between different metric measurements - such as converting inches to metres and other units. I am thinking base class called Unit as follows. NOTE: I have not put in any fields to hold the number of units eg 2 metres, 5 inches and so on: public abstract class Unit { protected string _name; public Unit(string name) { _name = name; } } Then subclasses of

Change constraints based on device during run time

試著忘記壹切 提交于 2019-12-10 21:14:45
问题 I'm using Storyboard to set my constraints. While everything is perfect, I have a some views where I wish to change the constraints on only 3.5" devices. Is this possible? How can I do it? 回答1: You can define a macro to determine the screen size, like the following: #define isiPhone4 ([[UIScreen mainScreen] bounds].size.height == 480)?TRUE:FALSE Later in the code you can do something like this: if (isiPhone4) { self.constraint.constant = NEW_VALUE; } To access storyboard constraints from code

How to remove constraint based on columns from oracle database?

六眼飞鱼酱① 提交于 2019-12-10 20:39:51
问题 Is there is a way to remove a constraint (unique index) based on columns name? What I would like to do is to remove a constraint where columna name is name, and name_type. ALTER TABLE MY_TABLE DROP CONSTRAINT NAME_OF_CONSTRAINT; I don't have a name so I would like to do it this way... ALTER TABLE MY_TABLE DROP CONSTRAINT **WHERE COLUMN = col1 AND column = col2** Any syntax to do something like this on a constraint. 回答1: I didn't think this was possible with a single statement, but it turns

Syntax error when defining table with ON DELETE CASCADE

爷,独闯天下 提交于 2019-12-10 20:16:46
问题 I'm trying to use ON DELETE CASCADE in a FK constraint in MS Access 2007, but I'm getting an error on table definition: SQL Error: Syntax error in CONSTRAINT clause. Here's the code for creating the table: CREATE TABLE Area ( Id AUTOINCREMENT PRIMARY KEY, AreaType__Id int NOT NULL, Tbl1 text(31) NOT NULL, Tbl2__Id int NOT NULL, CONSTRAINT UK_Area_1 UNIQUE (Tbl1, Container__Id), CONSTRAINT FK_Area_1 FOREIGN KEY (AreaType__Id) REFERENCES AreaType (Id), CONSTRAINT FK_Area_2 FOREIGN KEY (Tbl2__Id

implementing UNIQUE across linked tables in MySQL

蹲街弑〆低调 提交于 2019-12-10 20:03:52
问题 a USER is a PERSON and a PERSON has a COMPANY - user -> person is one-to-one, person -> company is many-to-one. person_id is FK in USER table. company_id is FK in PERSON table. A PERSON may not be a USER, but a USER is always a PERSON. If company_id was in user table, I could create a unique key based on username and company_id, but it isn't, and would be a duplication of data if it was. Currently, I'm implementing the unique username/company ID rule in the RoseDB manager wrapper code, but it