sqlparser/language.cpp
// Inline named constraint can be specified in SQL Server, Oracle
Inline named constraint can be specified in SQL Server, Oracle
Inline named constraint can be specified in SQL Server Oracle
bool SqlParser::ParseInlineColumnConstraint(Token *type, Token *type_end, Token *constraint, int num)
{
	if(constraint == NULL || Token::Compare(constraint, "CONSTRAINT", L"CONSTRAINT", 10) == false)
		return false;
	Token *name = GetNextToken();
	if(name == NULL)
		return false;
	 is not supported in Redshift
	if(_target == SQL_REDSHIFT)
		Comment(constraint, name);
	Token *cns = GetNextToken();
	if(cns == NULL)
		return false;
	bool exists = false;
	ListW pkcols;
	if(ParseKeyConstraint(NULL, NULL, cns, pkcols, true, NULL) == true)
		exists = true;
	else
	if(ParseForeignKey(cns) == true)
		exists = true;
	else
	if(ParseCheckConstraint(cns) == true)
		exists = true;
	else
	if(cns->Compare("DEFAULT", L"DEFAULT", 7) == true)
	{
		exists = ParseDefaultExpression(type, type_end, cns, num);
		if(exists == true && _target == SQL_ORACLE)
			Token::Remove(constraint, name);
	}
	if(exists == true)
		ParseConstraintOption();
	return exists;
}
bool SqlParser :: ParseInlineColumnConstraint ( Token * type , Token * type_end , Token * constraint , int num ) { if ( constraint == NULL || Token :: Compare ( constraint , " " , L" " , 10 ) == false ) return false ; Token * name = GetNextToken ( ) ; if ( name == NULL ) return false ; if ( _target == SQL_REDSHIFT ) Comment ( constraint , name ) ; Token * cns = GetNextToken ( ) ; if ( cns == NULL ) return false ; bool exists = false ; ListW pkcols ; if ( ParseKeyConstraint ( NULL , NULL , cns , pkcols , true , NULL ) == true ) exists = true ; else if ( ParseForeignKey ( cns ) == true ) exists = true ; else if ( ParseCheckConstraint ( cns ) == true ) exists = true ; else if ( cns -> Compare ( " " , L" " , 7 ) == true ) { exists = ParseDefaultExpression ( type , type_end , cns , num ) ; if ( exists == true && _target == SQL_ORACLE ) Token :: Remove ( constraint , name ) ; } if ( exists == true ) ParseConstraintOption ( ) ; return exists ; }
Inline named constraint can be specified in SQL Server, Oracle
Inline named constraint can be specified in SQL Server Oracle
// CONSTRAINT keyword before the name // Constraint name // Constraint name is not supported in Redshift // Constraint type keyword // Parse PRIMARY KEY, UNIQUE in database and INDEX in MySQL  // Check for FOREIGN KEY // CHECK constraint // Named DEFAULT allowed in SQL Server, but not allowed in Oracle // Check for constraint option