Create a TableAlias for path or userAlias
@param aCld
@param aPath
@param aUserAlias
@param hints a List os Class objects to be used as hints for path expressions
@return TableAlias
177083
private TableAlias createTableAlias(ClassDescriptor aCld, String aPath, String aUserAlias, List hints)
    {
		if (aUserAlias == null)
		{
			return createTableAlias(aCld, hints, aPath);
		}
		else
		{
			return createTableAlias(aCld, hints, aUserAlias + ALIAS_SEPARATOR + aPath);
		}
    }
181865
public function aliasRelationshipWhere($column, $tableAlias, $pivotAlias, $pivot)
    {
        //first explode the string on "." in case it was given with the table already included
        $split = explode('.', $column);

        //if the second split item exists, there was a "."
        if (isset($split[1])) {
            //if the table name is the pivot table, append the pivot alias
            if ($split[0] === $pivot) {
                return $pivotAlias.'.'.$split[1];
            }
            //otherwise append the table alias
            else {
                return $tableAlias.'.'.$split[1];
            }
        } else {
            return $tableAlias.'.'.$column;
        }
    }
948866
private FieldDescriptor getFldFromJoin(TableAlias aTableAlias, String aColName)
    {
        FieldDescriptor fld = null;

        // Search Join Structure for attribute
        if (aTableAlias.joins != null)
        {
            Iterator itr = aTableAlias.joins.iterator();
            while (itr.hasNext())
            {
                Join join = (Join) itr.next();
                ClassDescriptor cld = join.right.cld;

                if (cld != null)
                {
                    fld = cld.getFieldDescriptorByName(aColName);
                    if (fld != null)
                    {
                        break;
                    }

                }
            }
        }
        return fld;
    }
36790
public void setACL(final String path, List<ACL> acl, int version,
            StatCallback cb, Object ctx) {
        verbotenThreadCheck();
        final String clientPath = path;
        PathUtils.validatePath(clientPath);

        final String serverPath = prependChroot(clientPath);

        RequestHeader h = new RequestHeader();
        h.setType(ZooDefs.OpCode.setACL);
        SetACLRequest request = new SetACLRequest();
        request.setPath(serverPath);
        request.setAcl(acl);
        request.setVersion(version);
        SetACLResponse response = new SetACLResponse();
        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb,
                clientPath, serverPath, ctx, null);
    }
527219
public function getSQLTableAlias($tableName, $dqlAlias = '')
    {
        $tableName .= $dqlAlias ? '@[' . $dqlAlias . ']' : '';

        if (! isset($this->tableAliasMap[$tableName])) {
            $this->tableAliasMap[$tableName] = 't' . $this->tableAliasCounter++;
        }

        return $this->tableAliasMap[$tableName];
    }
214102
public void setAlias(String alias)
	{
		m_alias = alias;
		String attributePath = (String)getAttribute();
		boolean allPathsAliased = true;
		m_userAlias = new UserAlias(alias, attributePath, allPathsAliased);
		
	}
1345612
private static function createUriString(string $scheme, string $authority, string $path, string $query, string $fragment): string
    {
        $uri = '';
        if ($scheme !== '') {
            $uri .= $scheme . ':';
        }

        if ($authority !== '') {
            $uri .= '//' . $authority;
        }

        if ($path !== '') {
            if ($path[0] !== '/') {
                if ('' != $authority) {
                    // If the path is rootless and an authority is present, the path MUST be prefixed by "/"
                    $path = '/' . $path;
                }
            } elseif (isset($path[1]) && '/' === $path[1]) {
                if ('' == $authority) {
                    // If the path is starting with more than one "/" and no authority is present, the
                    // starting slashes MUST be reduced to one.
                    $path = '/' . ltrim($path, '/');
                }
            }

            $uri .= $path;
        }

        if ($query !== '') {
            $uri .= '?' . $query;
        }

        if ($fragment !== '') {
            $uri .= '#' . $fragment;
        }

        return $uri;
    }
514917
@Override
    protected AstNode parseGrantStatement( DdlTokenStream tokens,
                                           AstNode parentNode ) throws ParsingException {
        assert tokens != null;
        assert parentNode != null;
        assert tokens.matches(GRANT);

        markStartOfStatement(tokens);

        // NOTE: The first wack at this does not take into account the apparent potential repeating name elements after each type
        // declaration. Example:
        // GRANT { { SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFERENCES | TRIGGER }
        // [,...] | ALL [ PRIVILEGES ] }
        // ON [ TABLE ] tablename [, ...]
        // TO { [ GROUP ] rolename | PUBLIC } [, ...] [ WITH GRANT OPTION ]
        //
        // the "ON [ TABLE ] tablename [, ...]" seems to indicate that you can grant privileges on multiple tables at once, which
        // is
        // different thatn the SQL 92 standard. So this pass ONLY allows one and an parsing error will probably occur if multiple.
        //
        // Syntax for tables
        //
        // GRANT <privileges> ON <object name>
        // TO <grantee> [ { <comma> <grantee> }... ]
        // [ WITH GRANT OPTION ]
        //
        // <object name> ::=
        // [ TABLE ] <table name>
        // | SEQUENCE <sequence name>
        // | DATABASE <db name>
        // | FOREIGN DATA WRAPPER <fdw name>
        // | FOREIGN SERVER <server name>
        // | FUNCTION <function name>
        // | LANGUAGE <language name>
        // | SCHEMA <schema name>
        // | TABLESPACE <tablespace name>

        //
        // Syntax for roles
        //
        // GRANT roleName [ {, roleName }* ] TO grantees

        // privilege-types
        //
        // ALL PRIVILEGES | privilege-list
        //
        List<AstNode> grantNodes = new ArrayList<AstNode>();
        boolean allPrivileges = false;

        List<AstNode> privileges = new ArrayList<AstNode>();

        tokens.consume("GRANT");

        if (tokens.canConsume("ALL", "PRIVILEGES")) {
            allPrivileges = true;
        } else {
            parseGrantPrivileges(tokens, privileges);
        }

        if (allPrivileges || !privileges.isEmpty()) {

            tokens.consume("ON");

            if (tokens.canConsume("SCHEMA")) {
                grantNodes = parseMultipleGrantTargets(tokens, parentNode, TYPE_GRANT_ON_SCHEMA_STATEMENT);
            } else if (tokens.canConsume("SEQUENCE")) {
                grantNodes = parseMultipleGrantTargets(tokens, parentNode, TYPE_GRANT_ON_SEQUENCE_STATEMENT);
            } else if (tokens.canConsume("TABLESPACE")) {
                grantNodes = parseMultipleGrantTargets(tokens, parentNode, TYPE_GRANT_ON_TABLESPACE_STATEMENT);
            } else if (tokens.canConsume("DATABASE")) {
                grantNodes = parseMultipleGrantTargets(tokens, parentNode, TYPE_GRANT_ON_DATABASE_STATEMENT);
            } else if (tokens.canConsume("FUNCTION")) {
                grantNodes = parseFunctionAndParameters(tokens, parentNode);
            } else if (tokens.canConsume("LANGUAGE")) {
                grantNodes = parseMultipleGrantTargets(tokens, parentNode, TYPE_GRANT_ON_LANGUAGE_STATEMENT);
            } else if (tokens.canConsume("FOREIGN", "DATA", "WRAPPER")) {
                grantNodes = parseMultipleGrantTargets(tokens, parentNode, TYPE_GRANT_ON_FOREIGN_DATA_WRAPPER_STATEMENT);
            } else if (tokens.canConsume("FOREIGN", "SERVER")) {
                grantNodes = parseMultipleGrantTargets(tokens, parentNode, TYPE_GRANT_ON_FOREIGN_SERVER_STATEMENT);
            } else {
                tokens.canConsume(TABLE); // OPTIONAL
                String name = parseName(tokens);
                AstNode grantNode = nodeFactory().node(name, parentNode, TYPE_GRANT_ON_TABLE_STATEMENT);
                grantNodes.add(grantNode);
                while (tokens.canConsume(COMMA)) {
                    // Assume more names here
                    name = parseName(tokens);
                    grantNode = nodeFactory().node(name, parentNode, TYPE_GRANT_ON_TABLE_STATEMENT);
                    grantNodes.add(grantNode);
                }
            }
        } else {
            // Assume ROLES here
            // role [, ...]
            AstNode grantNode = nodeFactory().node("roles", parentNode, TYPE_GRANT_ROLES_STATEMENT);
            grantNodes.add(grantNode);
            do {
                String role = parseName(tokens);
                nodeFactory().node(role, grantNode, ROLE);
            } while (tokens.canConsume(COMMA));
        }

        tokens.consume("TO");
        List<String> grantees = new ArrayList<String>();

        do {
            String grantee = parseName(tokens);
            grantees.add(grantee);
        } while (tokens.canConsume(COMMA));

        boolean withGrantOption = false;
        if (tokens.canConsume("WITH", "GRANT", "OPTION")) {
            withGrantOption = true;
        }

        // Set all properties and children on Grant Nodes
        for (AstNode grantNode : grantNodes) {
            List<AstNode> copyOfPrivileges = copyOfPrivileges(privileges);
            // Attach privileges to grant node
            for (AstNode node : copyOfPrivileges) {
                node.setParent(grantNode);
            }
            if (allPrivileges) {
                grantNode.setProperty(ALL_PRIVILEGES, allPrivileges);
            }
            for (String grantee : grantees) {
                nodeFactory().node(grantee, grantNode, GRANTEE);
            }

            if (withGrantOption) {
                AstNode optionNode = nodeFactory().node("withGrant", grantNode, TYPE_STATEMENT_OPTION);
                optionNode.setProperty(VALUE, "WITH GRANT OPTION");
            }
        }
        AstNode firstGrantNode = grantNodes.get(0);

        markEndOfStatement(tokens, firstGrantNode);

        // Update additional grant nodes with statement info

        for (int i = 1; i < grantNodes.size(); i++) {
            AstNode grantNode = grantNodes.get(i);
            grantNode.setProperty(DDL_EXPRESSION, firstGrantNode.getProperty(DDL_EXPRESSION));
            grantNode.setProperty(DDL_LENGTH, firstGrantNode.getProperty(DDL_LENGTH));
            grantNode.setProperty(DDL_START_LINE_NUMBER, firstGrantNode.getProperty(DDL_START_LINE_NUMBER));
            grantNode.setProperty(DDL_START_CHAR_INDEX, firstGrantNode.getProperty(DDL_START_CHAR_INDEX));
            grantNode.setProperty(DDL_START_COLUMN_NUMBER, firstGrantNode.getProperty(DDL_START_COLUMN_NUMBER));
        }

        return grantNodes.get(0);
    }
806121
function convertToAlias(id, paths) {
    var invertedPaths = _.invert(paths);
    if (invertedPaths[id]) {
        return invertedPaths[id];
    }
    else {
        return id;
    }
}
475468
function localizePaths(pathList) {
  // resolve paths so that './foo/bar.js' and 'foo/bar.js' resolve to the same localized path
  pathList = pathList.map(function (p) {
    var resolvedPath = path.resolve(p);
    if (resolvedPath.substr(resolvedPath.length - 3) === '.js') {
      resolvedPath = resolvedPath.substr(0, resolvedPath.length - 3);
    }
    return resolvedPath;
  });

  var localizedPathList = [];
  if (pathList.length > 0) {
    var commonPath = null;
    pathList.forEach(function (fullPath, i) {
      var parts;
      if (commonPath === null) {
        parts = fullPath.split('/');
        if (parts.length > 1) {
          commonPath = parts.slice(0, parts.length - 1).join('/') + '/';
        } else {
          commonPath = '';
        }
      } else if (commonPath.length > 0) {
        parts = commonPath.split('/');
        parts.pop();
        commonPath = '';
        for (var partIndex = 0; partIndex < parts.length; partIndex++) {
          var testPath = commonPath + parts[partIndex] + '/';
          if (fullPath.substring(0, testPath.length) === testPath) {
            commonPath = testPath;
          } else {
            break;
          }
        }
      }
    });
    pathList.forEach(function (fullPath, i) {
      localizedPathList.push(fullPath.substr(commonPath.length));
    });
  }
  return localizedPathList;
}
1313448
private static String generateAliasRoot(String description) {
    String result = truncate(unqualifyEntityName(description), ALIAS_TRUNCATE_LENGTH)
        // Important to use Locale.ENGLISH.  See HHH-8579.  #toLowerCase() uses the default Locale.  Certain DBs
        // do not like non-ascii characters in aliases, etc., so ensure consistency/portability here.
        .toLowerCase(Locale.ENGLISH)
        .replace('/', '_') // entityNames may now include slashes for the representations
        .replace('$', '_'); //classname may be an inner class
    result = cleanAlias(result);
    if (Character.isDigit(result.charAt(result.length() - 1))) {
      return result + "x"; //ick!
    } else {
      return result;
    }
  }
936108
public function wherePk($pkData,$table = null,$tableAlias = null)
	{
		if(null === $table)
		{
			$table = $this->tableName();
		}
		if(null === $tableAlias)
		{
			$tableAlias = $table;
		}
		if(empty($this->fields) || $table !== $this->tableName())
		{
			$this->loadFields($fields, $fieldNames, $pk, $bitFields, $table);
		}
		else
		{
			$pk = $this->pk;
		}
		if(is_array($pk))
		{
			$where = array();
			$tWhere = &$where;
			foreach($pk as $pkName)
			{
				if(isset($pkData[$pkName]))
				{
					$tWhere['and'] = array((false === $tableAlias ? '' : ($tableAlias . '.')) . $pkName => $pkData[$pkName]);
					$tWhere = &$tWhere['and'];
				}
			}
		}
		else
		{
			$where = array((false === $tableAlias ? '' : ($tableAlias . '.')) . $pk=>is_array($pkData) ? $pkData[$pk] : $pkData);
		}
		return $this->where($where);
	}
1192397
function maybeCreateAliasRecords(result, callback) {

      let records = result.records.ResourceRecordSets.filter(r=> r.Type === 'A').map(r=> r.Name)
      let stagingExists = records.includes(`staging.${domain}.`)
      let productionExists = records.includes(`${domain}.`)
      let skip = stagingExists && productionExists
      if (skip) {
        let records = result.records.ResourceRecordSets.filter(r=> r.Type === 'A')
        let staging = records.find(r=> r.Name === `staging.${domain}.`)
        let production = records.find(r=> r.Name === `${domain}.`)
        console.log(chalk.green.dim('✔ A Records'))
        console.log(chalk.grey(`          Production ${chalk.green.bold.underline(production.Name)}`))
        console.log(chalk.grey(`             Staging ${chalk.green.bold.underline(staging.Name)}`))
        callback()
      }
      else {

        let staging = result.apis.items.find(api=> api.domainName === `staging.${domain}`)
        let production = result.apis.items.find(api=> api.domainName === domain)
        route53.changeResourceRecordSets({
          ChangeBatch: {
            Changes: [{
              Action: 'UPSERT',
              ResourceRecordSet: {
                AliasTarget: {
                  DNSName: production.distributionDomainName,
                  EvaluateTargetHealth: false,
                  HostedZoneId: 'Z2FDTNDATAQYW2', /* ah, yes of course */
                },
                Name: domain,
                Type: "A"
              }
            },
            {
              Action: 'UPSERT',
              ResourceRecordSet: {
                AliasTarget: {
                  DNSName: staging.distributionDomainName,
                  EvaluateTargetHealth: false,
                  HostedZoneId: 'Z2FDTNDATAQYW2', /* ah, yes of course */
                },
                Name: `staging.${domain}`,
                Type: "A"
              }

            }],
            Comment: "defined by .arc @domain " + domain
          },
          HostedZoneId
        },
        function done(err) {
          if (err) callback(err)
          else {
            console.log(chalk.green.dim('✔ Created A Records'))
            callback()
          }
        })
      }
    }
443932
def table_path(cls, project, instance, table):
        """"""
        return google.api_core.path_template.expand(
            "projects/{project}/instances/{instance}/tables/{table}",
            project=project,
            instance=instance,
            table=table,
        )
989249
public TableAlias addTable(String table, String aliasPrefix) {

        String alias = makeAlias(aliasPrefix);
        m_tables.add(table + " " + alias);
        return new TableAlias(alias);

    }
1239282
private TableAlias createTableAlias(String table, String path)
    {
        TableAlias alias;

        if (table == null)
        {
            getLogger().warn("Creating TableAlias without table for path: " + path);
        }

        String aliasName = String.valueOf(getAliasChar()) + m_aliasCount++; // + m_pathToAlias.size();
        alias = new TableAlias(table, aliasName);
        setTableAliasForPath(path, null, alias);        
        m_logger.debug("createTableAlias2: path: " + path + " tableAlias: " + alias);

        return alias;
    }
1270
protected function storeCustomAliasPath(
        $locationId,
        $path,
        $languageCode,
        $alwaysAvailable,
        $forwarding
    ) {
        $queryBuilder = $this->connection->createQueryBuilder();

        $queryBuilder->insert(static::CUSTOM_ALIAS_BACKUP_TABLE);
        $queryBuilder->values(
            [
                'id' => '?',
                'location_id' => '?',
                'path' => '?',
                'language_code' => '?',
                'always_available' => '?',
                'forwarding' => '?',
            ]
        );
        $queryBuilder->setParameter(0, 0);
        $queryBuilder->setParameter(1, $locationId);
        $queryBuilder->setParameter(2, $path);
        $queryBuilder->setParameter(3, $languageCode);
        $queryBuilder->setParameter(4, (int)$alwaysAvailable);
        $queryBuilder->setParameter(5, (int)$forwarding);

        $queryBuilder->execute();
    }