sqlparser/language.cpp
bool SqlParser::ParseInlineColumnConstraint(Token *type, Token *type_end, Token *constraint, int num)
{
	// CONSTRAINT keyword before the name
	if(constraint == NULL || Token::Compare(constraint, "CONSTRAINT", L"CONSTRAINT", 10) == false)
		return false;

	// Constraint name
	Token *name = GetNextToken();

	if(name == NULL)
		return false;

	// Constraint name is not supported in Redshift
	if(_target == SQL_REDSHIFT)
		Comment(constraint, name);

	// Constraint type keyword
	Token *cns = GetNextToken();

	if(cns == NULL)
		return false;

	bool exists = false;

	ListW pkcols;

	// Parse PRIMARY KEY, UNIQUE in database and INDEX in MySQL 
	if(ParseKeyConstraint(NULL, NULL, cns, pkcols, true, NULL) == true)
		exists = true;
	else
	// Check for FOREIGN KEY
	if(ParseForeignKey(cns) == true)
		exists = true;
	else
	// CHECK constraint
	if(ParseCheckConstraint(cns) == true)
		exists = true;
	else
	if(cns->Compare("DEFAULT", L"DEFAULT", 7) == true)
	{
		exists = ParseDefaultExpression(type, type_end, cns, num);

		// Named DEFAULT allowed in SQL Server, but not allowed in Oracle
		if(exists == true && _target == SQL_ORACLE)
			Token::Remove(constraint, name);
	}

	// Check for constraint option
	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
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