Exemplo n.º 1
0
NABoolean CmpSqlSession::validateVolatileQualifiedSchemaName
(QualifiedName &inName)
{
  if (NOT inName.getSchemaName().isNull())
    {
      if (!validateVolatileSchemaName((NAString&)inName.getSchemaNameAsAnsiString()))
	return FALSE;
    }

  return TRUE;
}
Exemplo n.º 2
0
NABoolean CmpSqlSession::validateVolatileQualifiedName(QualifiedName &inName)
{
  if (NOT Get_SqlParser_Flags(ALLOW_VOLATILE_SCHEMA_IN_TABLE_NAME))
    {
      if (NOT inName.getCatalogName().isNull())
	{
	  // cannot be a 3-part name
	  *CmpCommon::diags() << DgSqlCode(-4192);
	  return FALSE;
	}
      
      if (NOT inName.getSchemaName().isNull())
	{
	  // validate that the schemaName part is the currentUserName
	  if (inName.getSchemaName() != externalUserName_)
	    {
	      *CmpCommon::diags() << DgSqlCode(-4191) <<
		DgString0(inName.getSchemaName()) <<
		DgString1(externalUserName_);
	      return FALSE;
	    }
	}
    }
  else
    {
      // Volatile schema name is allowed.
      // Make sure that it is a valid volatile 3 part name.
      if ((NOT inName.getCatalogName().isNull()) &&
	  (NOT inName.getSchemaName().isNull()))
	{
	  // move to a temp to upcase
	  ComSchemaName csn(inName.getSchemaName());
	  
	  ULng32 len = 
	    MINOF(strlen(csn.getSchemaNamePartAsAnsiString().data()),
		  strlen(COM_VOLATILE_SCHEMA_PREFIX));
	  NAString upSch(csn.getSchemaNamePartAsAnsiString().data());
	  upSch.toUpper();
	  if ((len < strlen(COM_VOLATILE_SCHEMA_PREFIX)) ||
	      (strncmp(upSch.data(), COM_VOLATILE_SCHEMA_PREFIX, len) != 0))
	    {
	      *CmpCommon::diags() << DgSqlCode(-4192);
	      return FALSE;
	    }
	}
      else if (NOT inName.getSchemaName().isNull())
	{
	  // 2 part name
	  // validate that the schemaName part is the currentUserName
	  if (inName.getSchemaName() != externalUserName_)
	    {
	      *CmpCommon::diags() << DgSqlCode(-4191) <<
		DgString0(inName.getSchemaName()) <<
		DgString1(externalUserName_);
	      return FALSE;
	    }
	}
    }

  return TRUE;
}
Exemplo n.º 3
0
NABoolean TriggerDB::isHiveTable(QualifiedName& name)
{
   return strcmp(name.getSchemaName(), "HIVE") == 0;
}