Determine whether a database or table name is valid.

A name is valid if and only if: it starts with an alphanumeric character, contains only alphanumeric characters
and '_', and is NOT composed of numbers only.
775479
protected static boolean isNameValid(String name) {
    Preconditions.checkNotNull(name);
    name = name.toLowerCase();
    return VALID_DB_TABLE_NAME_PATTERN_1.matcher(name).matches()
        && VALID_DB_TABLE_NAME_PATTERN_2.matcher(name).matches();
  }
175143
public static boolean isValidNcName( String name ) {
        if (name == null || name.length() == 0) return false;
        CharacterIterator iter = new StringCharacterIterator(name);
        char c = iter.first();
        if (!isValidNcNameStart(c)) return false;
        while (c != CharacterIterator.DONE) {
            if (!isValidNcName(c)) return false;
            c = iter.next();
        }
        return true;
    }
546035
public static void validateAttributeName(String name) {
    checkForKeyword(name);

    validateName(name);

    if (!name.matches("[a-zA-Z0-9_#]+(-[a-z]{2,3})??$")) {
      throw new MolgenisDataException(
          "Invalid characters in: ["
              + name
              + "] Only letters (a-z, A-Z), digits (0-9), underscores (_) and hashes (#) are allowed.");
    }
  }
551523
public static void checkName(String s) {
    for (char c : s.toCharArray()) {
      if (c == '.' ||
          c == '-' ||
          c == '~' ||
          c == ',' ||
          c == '@' ||
          c == ' ' ||
          c == '(' ||
          c == ')' ||
          c == '+' ||
          c == '!' ||
          c == '\'' ||
          c == '%' ||
          c == '#') {
        continue;
      }
      if (c < 32 || c >= 127 || !Character.isJavaIdentifierPart(c)) {
        throw new IllegalArgumentException(
          "Cache name contains illegal character: '" + c + "', name=\"" + s + "\"");
      }
    }
  }
506933
def name=(v)
      DataTypeValidator.validate :table_name, [String], v
      if v.is_a?(String)
        @name = v
      end
    end
951695
public static boolean isValidNCName(String ncName) {
    final int length = ncName.length();
    if (length == 0) {
      return false;
    }
    char ch = ncName.charAt(0);
    if (!isNCNameStart(ch)) {
      return false;
    }
    for (int i = 1; i < length; ++i) {
      ch = ncName.charAt(i);
      if (!isNCName(ch)) {
        return false;
      }
    }
    return true;
  }
106259
public static boolean isValidName(String name) {
    final int length = name.length();
    if (length == 0) {
      return false;
    }
    char ch = name.charAt(0);
    if (!isNameStart(ch)) {
      return false;
    }
    for (int i = 1; i < length; ++i) {
      ch = name.charAt(i);
      if (!isName(ch)) {
        return false;
      }
    }
    return true;
  }
213345
private void validateAsMongoDBFieldName(String fieldName) {
		if ( fieldName.startsWith( "$" ) ) {
			throw log.fieldNameHasInvalidDollarPrefix( fieldName );
		}
		else if ( fieldName.contains( "\u0000" ) ) {
			throw log.fieldNameContainsNULCharacter( fieldName );
		}
	}
1194502
def tableexists(tablename):
    """"""
    result = True
    try:
        t = table(tablename, ack=False)
    except:
        result = False
    return result
1003366
public function validateTableName()
    {
        if (strpos($this->tableName, '*') !== false && substr($this->tableName, -1) !== '*') {
            $this->addError('tableName', 'Asterisk is only allowed as the last character.');

            return;
        }
        $tables = $this->getTableNames();
        if (empty($tables)) {
            $this->addError('tableName', "Table '{$this->tableName}' does not exist.");
        } else {
            foreach ($tables as $table) {
                $class = $this->generateClassName($table);
                if ($this->isReservedKeyword($class)) {
                    $this->addError('tableName', "Table '$table' will generate a class which is a reserved PHP keyword.");
                    break;
                }
            }
        }
    }
959719
def has_table(self, name):
        """"""
        return len(self.sql("SELECT name FROM sqlite_master WHERE type='table' AND name=?",
                            parameters=(name,), asrecarray=False, cache=False)) > 0
237058
private void validate() {
        if(driverClass == null) {
            throw new IllegalArgumentException("Driver class must be specified");
        }
        if(catalog == null || catalog.isEmpty()) {
            throw new IllegalArgumentException("Schema name must be specified");
        }
        if(table == null || table.isEmpty()) {
            throw new IllegalArgumentException("Table name must be specified");
        }
        if(connectionUrl == null || connectionUrl.isEmpty()) {
            if((host != null && !host.isEmpty()) && (port > 0)) {
                connectionUrl(getJdbcUrl());
            } else {
                throw new IllegalArgumentException("You must specify at least one of connectionUrl or host and port properties");
            }
        }
        if(partitionKey == null && numPartitions > 1) {
            throw new IllegalArgumentException("You must define a valid partition key for using more than one partition.");
        }
    }
378728
def table(self, name: str):
        
        if self._check_db() == False:
            return
        try:
            res = self.getall(name)
        except Exception as e:
            self.err(e, self.table, "Can not get records from database")
            return
        if res is None:
            self.warning("Table", name, "does not contain any record")
            return
        num = len(res)
        self.info(num, "rows")
        self.info("Fields:", ", ".join(list(res)))
692816
def _validate_name(name):
    
    if name is None:
        return

    # The first and las characters must be alphanumeric.
    if not all([name[0].isalnum(), name[-1].isalnum()]):
        raise ValueError("Bucket names must start and end with a number or letter.")
    return name
609910
protected static boolean checkTableExist(Jdbc jdbc, String tableName) {
		String sql = "select 1 from " + tableName + " limit 1;";
		try {
			jdbc.queryForInt(sql);
			return true;
		}
		catch (BadSqlGrammarException e) {
			return false;
		}

	}
836473
function checkForReservedTableName(args) {
  if (!args) {
    return;
  }
  if (args.databaseTypeName) {
    checkTableName(args.name, args.databaseTypeName, args.shouldThrow);
  } else {
    for (let i = 0, types = Object.keys(DatabaseTypes); i < types.length; i++) {
      if (typeof DatabaseTypes[types[i]] !== 'function') {
        checkTableName(args.name, DatabaseTypes[types[i]], args.shouldThrow);
      }
    }
  }
}
1171687
def check_name(name, safe_chars):
    '''
    
    '''
    regexp = re.compile('[^{0}]'.format(safe_chars))
    if regexp.search(name):
        raise SaltCloudException(
            '{0} contains characters not supported by this cloud provider. '
            'Valid characters are: {1}'.format(
                name, safe_chars
            )
        )