constraints

How can I temporarily disable all constraints in a Table in Firebird 2.1?

I want to disable all Foreign key constraints and re-enable them after, is there some way to do that? I know that SQLServer allows that, but what about Firebird? ...

I'm having problems with MySQL constraints

Hi guys. I'm having some trouble using constraints correctly. I have three tables, 'item', 'store' and 'link_item_store'. An Item can be in one or many stores, and one or many stores can have an item. Since this is a many to many relationship, I'm using 'link_item_store' to normalize. If I delete an item, I have to remove all instancs...

Algorithms for Updating Relational Data

What algorithms are known to perform the task of updating a database by inserting, updating, and deleting rows in the presence of database constraints? More specifically, say that before images of rows to be deleted, after images of rows to be inserted, and both images of rows to be updated are in memory. The rows might be for several t...

SQLServer2000 Constraints

Is there any way to remove all forgeinKey and primary key contriants from Database ? ...

How can I use interface as a C# generic type constraint?

Is there a way to get the following function declaration? public bool Foo<T>() where T : interface; ie. where T is an interface type (similar to where T : class, and struct). Currently I've settled for: public bool Foo<T>() where T : IBase; Where IBase is defined as an empty interface that is inherited by all my custom interfaces....

What is the correct way to implement the NUnit 2.5 Constraint.Write*() methods?

Hello: I'm planning to implement my own set of constraints, and am having some difficulty understanding how to implement the following methods of the Constraint class. public abstract class Constraint { public abstract void WriteDescriptionTo( MessageWriter writer ); public virtual void WriteMessageTo( MessageWriter writer ); ...

ORM and Database Constraints

How compatible is ORM and existing databases that have a lot of constraints (particularly unique key constraints/unique indexes beyond primary keys) enforced within the database itself? (Often these are preexisting databases, shared by numerous legacy applications. But good database modeling practice is to define as many constraints as ...

ASP.net MVC custom route handler/constraint

I need to implement an MVC site with urls per below: category1/product/1/wiki category1/product/2/wiki category1/sub-category2/product/3/wiki category1/sub-category2/sub-category3/product/4/wiki etc. etc. where the matching criteria is that the url ends with "wiki". Unfortunately the below catch-all works only in the last part of th...

How can I create a SQL unique constraint based on 2 columns ?

I have a Table like this one: |UserId | ContactID | ContactName --------------------------------------- | 12456 | Ax759 | Joe Smith | 12456 | Ax760 | Mary Smith | 12458 | Ax739 | Carl Lewis | 12460 | Ax759 | Chuck Norris | 12460 | Bx759 | Bruce Lee I need to add a constraint to this table s...

Finding all Nullable Columns in SQL 2000 Database

How to find out column with NULL values allowed in the insert in whole database ? ...

Type parameter constraints for the liskov principle in C#.NET

I try to create a generic interface that inherits the System.ICloneable interface but where the returntype of the Clone()-method is T. Of course the T-type needs constraints to be sure it's an inheritance of the System.Object-class but the following code is not working. public interface ICloneable<T> : System.ICloneable where T : object...

Detecting Interfaces in Generic Types

Hi, I have a method: public void StoreUsingKey<T>(T value) where T : class, new() { var idModel = value as IIDModel; if (idModel != null) Store<T>(idModel); AddToCacheUsingKey(value); } that I would like to optionally call the following method, based on the value parameter's implementation of IIDModel. public void Store...

SQL Server Check Constraint Inquiry

I have a table which stores payments and want to ensure if the payment method is a credit card then the card type field should be IN ('Visa', 'MasterCard', 'Discover', 'American Express'), however if the payment method is not a credit card then the card type field should be NULL. Will a check constraint allow me to use a statement like ...

What is the length limit of the HTML META tags?

And how do the constraints differ in practice on various browsers? ...

How to stop a process with time constraints

I think the topic might not be accurate enough, but I really don't know how to describe it in a very brief way... What I want to do is as follows: I have a process running some analysis (in Java) and trying to give a return value, but the whole analysis has a time constraint, say 10 seconds If the analysis gives a result within 10s, ...

C# Multiple generic constraints

Hi, I was wondering if it is possible to add multiple generic constraints? I have an Add method that takes an Object (Either Email, Phone or Address), so i was thinking something like: public void Add<T>(T Obj) where T : Address where T : Email where T : Phone { if (Obj is Address) m...

postgres: constraint check

Hi there, please have a look at the following table: name | x | y ---------+-----+------ foo | 3 | 5 bar | 45 | 99 foobar | 88 | barfoo | 0 | 45 I want to add a constraint CHECK ( y > x ), but this obviously will fail due it is violated by the row 'foobar'. How do I create a constraint that says: check (...

Can I specify a 'supertype' relation in C# generic constraints?

I have a collection class with an Equals method that I want to pass in a method to do equality checking between each item. Furthermore, I want to allow the delegate type to operate on superclasses of T as well as T itself: public delegate bool EqualityComparer<T>(T x, T y); public class Collection<T> { //... public bool Equals...

How to define a foreign key in Mnesia

Is there an equivalent to this SQL statement in Mnesia? alter table TABLE add foreign key (FIELD) references TABLE2 (FIELD2) ...

Changing MySQL primary key when foreign key contraints exist

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 ...