This function escapes column and table names
        @param item:
774593
def _escape_identifiers(self, item):
        
        if self._escape_char == '':
            return item

        for field in self._reserved_identifiers:
            if item.find('.%s' % field) != -1:
                _str = "%s%s" % (self._escape_char, item.replace('.', '%s.' % self._escape_char))
                # remove duplicates if the user already included the escape
                return re.sub(r'[%s]+'%self._escape_char, self._escape_char, _str)

        if item.find('.') != -1:
            _str = "%s%s%s" % (self._escape_char, item.replace('.', '%s.%s'%(self._escape_char, self._escape_char)),
            self._escape_char)
        else:
            _str = self._escape_char+item+self._escape_char
        # remove duplicates if the user already included the escape
        return re.sub(r'[%s]+'%self._escape_char, self._escape_char, _str)
1319612
function camelCaseToUnderscoreMap(columns) {
    var map = {};
    for (var i = 0; i < columns.length; i++)
        map[columns[i]] = toUnderscore(columns[i]);
    return map;
}
1359030
public String escapeTableName(final String tableName) {
        // step 1: to quote or no? how many single quotes?
        boolean toQuote = false;
        int apostropheCount = 0;
        for (int i = 0; i < tableName.length(); i++) {
            final char c = tableName.charAt(i);
            if (Character.isWhitespace(c) || c == '.') {
                toQuote = true;
            } else if (c == '\'') {
                toQuote = true;
                apostropheCount += 1;
            }
        }

        final StringBuilder sb = new StringBuilder(
                tableName.length() + (toQuote ? 2 : 0) + apostropheCount);

        // step 2: build the string
        if (toQuote) {
            sb.append(SINGLE_QUOTE);
        }
        for (int i = 0; i < tableName.length(); i++) {
            final char c = tableName.charAt(i);
            sb.append(c);
            if (c == '\'') {
                sb.append(SINGLE_QUOTE);
            }
        }
        if (toQuote) {
            sb.append(SINGLE_QUOTE);
        }
        return sb.toString();
    }
371235
private static String transColumnNameToFieldName(String colName) {
		if (StrUtils.isEmpty(colName))
			return colName;
		if (!colName.contains("_"))
			return StrUtils.toLowerCaseFirstOne(colName);
		StringBuilder sb = new StringBuilder();
		char[] chars = colName.toLowerCase().toCharArray();
		for (int i = 0; i < chars.length; i++) {
			char c = chars[i];
			if (c == '_')
				continue;
			if ((i > 0) && (chars[i - 1]) == '_' && sb.length() > 0)
				sb.append(Character.toUpperCase(c));
			else
				sb.append(c);
		}
		return sb.toString();
	}
20292
public function col_full_name($col, $table='', $escaped=false)
  {
    if ( \is_string($col) && ($col = trim($col)) ){
      $mcol = explode(".", str_replace("`", "", $col));
      if ( \count($mcol) > 1 ){
        $col = array_pop($mcol);
        $table = array_pop($mcol);
        $ok = 1;
      }
      else if ( !empty($table) ){
        $table = $this->table_simple_name($table);
        $col = end($mcol);
        $ok = 1;
      }
      if ( isset($ok) && bbn\str::check_name($table, $col) ){
        return $escaped ? "`".$table."`.`".$col."`" : $table.".".$col;
      }
    }
		return false;
  }
829873
def lineincols (inlist,colsize):
    
    outstr = ''
    for item in inlist:
        if type(item) != StringType:
            item = str(item)
        size = len(item)
        if size <= colsize:
            for i in range(colsize-size):
                outstr = outstr + ' '
            outstr = outstr + item
        else:
            outstr = outstr + item[0:colsize+1]
    return outstr
1307601
def quote_table_name(name)
      name.to_s.split('.').map{ |n| n.split('@').map{ |m| quote_column_name(m) }.join('@') }.join('.')
    end
1154252
function(item, fieldName) {
			if (fieldName === "FriendlyPath") { //$NON-NLS-0$
				// Just update the "is valid" column
				var rowNode = document.getElementById(this.myTree._treeModel.getId(item));
				var oldCell = lib.$(".isValidCell", rowNode); //$NON-NLS-0$
				var col_no = lib.$$array("td", rowNode).indexOf(oldCell); //$NON-NLS-0$
				var cell = this.renderer.getIsValidCell(col_no, item, rowNode);
				// replace oldCell with cell
				oldCell.parentNode.replaceChild(cell, oldCell);
			}
		}
1068072
def escape(value)
      if value.class == String
        value.gsub(/['"&<>]/) do |match|
          CONVERSION_TABLE.assoc(match).last
        end
      else
        value
      end
    end
13388
function _stylesheetListRenderer(item) {
        var html = "<span class='stylesheet-name'>" + _.escape(item.name);
        if (item.subDirStr) {
            html += "<span class='stylesheet-dir'> — " + _.escape(item.subDirStr) + "</span>";
        }
        html += "</span>";
        return html;
    }
547820
private function escape_column_name($column_names){
        $columns = [];
        foreach( explode(',', $column_names) as $column_name ){
            // trim
            $column_name = trim($column_name);
            // Remove special chars
            $columns[] = preg_replace('/[`\'";\n\r\\\\\\0]/u', '', $column_name);
        }
        return implode(', ', $columns);
    }
366519
def _sanitize_column_names(data):
    """"""
    new_names = {}
    for name in data.columns:
        new_names[name] = _ILLEGAL_CHARACTER_PAT.sub("_", name)
    return new_names
295853
function listitem(text) {
  if (inList()) {

    // capture value in trailing "text" - unescape makes regexp work
    var m = unescapeQuotes(text).match(/^(.*)\s+"([^"]*)"\s*$/);

    var txt = m ? escapeQuotes(m[1]) : text;
    var val = m ? escapeQuotes(m[2]) : text;

    return renderOption(txt, val);
  }
  return fallback.listitem.call(this, text);
}
1256609
@Override
    public void writeColumnNames(List<Column> columns) throws IOException {
        Writer writer = getWriter();
        for (int i = 0; i < columns.size(); i++) {
            checkSurroundByQuotesAndWrite(writer, getDelimiter(), columns.get(i).getName());
            if (i != columns.size() - 1) {
                writer.write(getDelimiter());
            }
        }
        writer.write(getEndline());
        writer.flush();
    }
473220
public String csvItem(CmsListItem item) {

        if (m_csvItemFormatter != null) {
            return m_csvItemFormatter.csvItem(item);
        } else {
            StringBuffer csv = new StringBuffer(1024);
            Iterator<CmsListColumnDefinition> itCols = m_columns.elementList().iterator();
            while (itCols.hasNext()) {
                CmsListColumnDefinition col = itCols.next();
                if (!col.isVisible()) {
                    continue;
                }
                csv.append(col.csvCell(item));
                csv.append("\t");
            }
            csv.append("\n");
            return csv.toString();
        }
    }
650572
def _format_row(row, colnames, tab):
    
    out=""

    out+="\n<tr>"
    for colname in colnames:
        out+="<td style='vertical-align:top; white-space:pre'>"
        out+=_format_cell(row[colname], tab.getcolkeywords(colname))
        out+="</td>\n"
    out+="</tr>\n"
    return out
1037329
def rename_item(self, table_name, item_old_name, item_new_name):
        
        # define some helper methods:

        def put_together_if_list(item):
            """
            String joining function
            that doesn't break with None/np.nan
            """
            try:
                res = ":".join(item)
                return ":".join(item)
            except TypeError as ex:
                #print ex
                return item

        def replace_colon_delimited_value(df, col_name, old_value, new_value):
            """
            Col must contain list
            """
            count = 1
            for index, row in df[df[col_name].notnull()].iterrows():
                names_list = row[col_name]
                names_list = [name.strip() for name in names_list]
                try:
                    ind = names_list.index(old_value)
                except ValueError as ex:
                    count += 1
                    continue
                names_list[ind] = new_value
                df.loc[count, col_name] = names_list
                count += 1

        # initialize some things
        item_type = table_name
        ###col_name = item_type[:-1] + "_name"
        col_name = item_type[:-1]
        col_name_plural = col_name + "s"
        table_df = self.tables[item_type].df

        if item_old_name == '':
            # just add a new item
            self.add_item(table_name, {col_name: item_new_name}, item_new_name)
            return

        # rename item in its own table
        table_df.rename(index={item_old_name: item_new_name}, inplace=True)
        # rename in any parent/child tables
        for table_name in self.tables:
            df = self.tables[table_name].df
            col_names = df.columns
            # change anywhere col_name (singular, i.e. site) is found
            if col_name in col_names:
                df[col_name].where(df[col_name] != item_old_name, item_new_name, inplace=True)
                # change anywhere col_name (plural, i.e. sites) is found
            if col_name_plural in col_names:
                df[col_name_plural + "_list"] = df[col_name_plural].str.split(":")
                replace_colon_delimited_value(df, col_name_plural + "_list", item_old_name, item_new_name)
                df[col_name_plural] = df[col_name_plural + "_list"].apply(put_together_if_list)
                df.drop(col_name_plural + "_list", axis=1, inplace=True)
            self.tables[table_name].df = df