constraints

Questions about implementing Domain class relationships & constraints in Grails

眉间皱痕 提交于 2019-12-22 00:18:51
问题 Using ArgoUML, I very quickly created this trivial representation of a few Domain classes (Person, Store, Product) and their relationships. I'm struggling with the implementation of the relationships. Below was my initial approach for the Person domain, but it seems that I am missing something important. class PersonToPerson { Person from Person to String relation static constraints = { relation(inList:["Friend to", "Enemy of", "Likes", "Hates"]) } static belongsTo = [ Person ] } class Person

CGAL - custom 2D point and intersection behavior in constrained delaunay triangulation

China☆狼群 提交于 2019-12-21 20:37:48
问题 In short, I have to generate a constrained delaunay triangulation from a set of 2D points that carry additional information. Since there could be intersecting constraints, I need that the triangulation properly interpolates the satellite data whenever it generates the new point of intersection. I tried with CGAL (C++) to define a custom kernel following the example here, but I've failed to compile it succesfully, basically because there is something fundamental of the underlying generic

SQL constraint to check whether value doesn't exist in another table

有些话、适合烂在心里 提交于 2019-12-21 20:23:06
问题 In my PostgreSQL 9.4 database, I have a table fields with a column name with unique values. I'm creating a new table fields_new with a similar structure (not important here) and a column name as well. I need a way to constraint name values to be inserted to the fields_new not to be present in fields.name . For example, if fields.name contains the values 'color' and 'length' , I need to prevent fields_new.name from containing 'color' or 'length' values. So, in other words I need to provide

Check Constraint that calls function does not work on update

ぐ巨炮叔叔 提交于 2019-12-21 17:45:17
问题 I created a constraint that prevents allocations in one table to exceed inventory in another table (please see the details in my previous question Here). But for some reason the constraint works as expected only when I insert new allocations, but on update it does not prevent violating. Here is my constraint: ([dbo].[fn_AllocationIsValid]([Itemid]) = 1) And here is the function: CREATE FUNCTION [dbo].[fn_AllocationIsValid] (@itemId as int) RETURNS int AS BEGIN DECLARE @isValid bit; SELECT

Codeigniter foreign key constraint check

爱⌒轻易说出口 提交于 2019-12-21 17:26:31
问题 Let me first explain the table structure: +-----------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | firstname | varchar(255) | NO | | NULL | | | name | varchar(255) | NO | | NULL | | +-----------+--------------+------+-----+---------+----------------+ The id field is referenced from another table through a foreign

SQL Server - Cascading DELETE with Recursive Foreign Keys

跟風遠走 提交于 2019-12-21 14:07:16
问题 I've spent a good amount of time trying to figure out how to implement a CASCADE ON DELETE for recursive primary keys on SQL Server for some time now. I've read about triggers, creating temporary tables, etc but have yet to find an answer that will work with my database design. Here is a Boss/Employee database example that will work for demonstration purposes: TABLE employee id|name |boss_id --|---------|------- 1 |John |1 2 |Hillary |1 3 |Hamilton |1 4 |Scott |2 5 |Susan |2 6 |Seth |2 7

How do you add a NOT NULL FOREIGN KEY column to an existing (populated) table in MS SQL?

强颜欢笑 提交于 2019-12-21 09:36:37
问题 I need to add a NOT NULL column to an existing (populated) table that will be a foreign key to another table. This brings about two problems: When you add the column, its value cannot be null - using a default is not an option (unless it is removed later on) because the database logic is used in the server side validation when a user enters a new record i.e. when the application tries to add a record with this field having a null value, the database throws an error that the application

Double generic constraint on class in Java: extends ConcreteClass & I

我们两清 提交于 2019-12-21 07:36:21
问题 Is there a way to define a generic constraint in Java which would be analogous to the following C# generic constratint ? class Class1<I,T> where I : Interface1, Class2 : I I'm trying to do it like this: class Class1<I extends Interface1, T extends I & Class2> But the compiler complains about the "Class2" part: Type parameter cannot be followed by other bounds. 回答1: The simplest way I can see of resolving the Java code is to make Class2 an interface. You cannot constrain a type parameter to

How to truncate all user tables?

亡梦爱人 提交于 2019-12-21 07:31:20
问题 How can I truncate all user table in oracle? I have problem with tables constraints. 回答1: declare begin for c1 in (select table_name, constraint_name from user_constraints) loop begin execute immediate ('alter table '||c1.table_name||' disable constraint '||c1.constraint_name); end; end loop; for t1 in (select table_name from user_tables) loop begin execute immediate ('truncate table '||t1.table_name); end; end loop; for c2 in (select table_name, constraint_name from user_constraints) loop

Auto-Layout Issues: iOS 7 vs iOS8

廉价感情. 提交于 2019-12-21 05:18:07
问题 I am trying to create a collapsible toolbar that works like this (running in iOS 7 -- ugly colors etc. for visualization purposes): However, when I run the code in iOS 8, this is what happens: I have set up a constraint system that is based on the following: A centering view (not shown) keeps the toolbar in the screen middle. A sizing view is adjusted to collapse the toolbar. The sizing view is anchored to the right of the centering view (via a trailing constraint). A container view holds the