<commit_before><?php

/**
 * SQL utiliy functions.
 *
 * @access public
 * @module dbsort
 * @package Database interfaces
 * @author <NAME>
 */

# Copyright (c) 2011 <NAME> <<EMAIL>>
#
# Licensed under the MIT, BSD and GPL licenses.


function sql_value ($v)
{
    type_string ($v);
    return mysql_real_escape_string ($v);
}

function sql_quote ($v)
{
    $v && type_string ($v);
    return '"' . mysql_real_escape_string ($v) . '"';
}

function sql_assignment ($k, $v)
{
    return sql_value ($k) . '=' . sql_quote ($v);
}

function sql_append_assignment ($x, $k, $v)
{
    return $x . ($x ? ',' : '') . sql_assignment ($k, $v);
}

/**
 * Convert array to SQL assignment list.
 *
 * @access public
 * @param array $values Field values keyed by their names.
 * @returns string
 * @package Database interfaces
 */
function sql_assignments ($values)
{
    type_array ($values);

    $x = '';
    foreach ($values as $k => $v)
        if (!is_numeric ($k))
            $x = sql_append_assignment ($x, $k, $v);
    return $x;
}

?><commit_msg>Caller can set another padding (e.g. ' AND ' instead of ', ').<commit_after><?php

/**
 * SQL utiliy functions.
 *
 * @access public
 * @module dbsort
 * @package Database interfaces
 * @author <NAME>
 */

# Copyright (c) 2011 <NAME> <<EMAIL>>
#
# Licensed under the MIT, BSD and GPL licenses.


function sql_value ($v)
{
    type_string ($v);
    return mysql_real_escape_string ($v);
}

function sql_quote ($v)
{
    $v && type_string ($v);
    return '"' . mysql_real_escape_string ($v) . '"';
}

function sql_assignment ($k, $v)
{
    return sql_value ($k) . '=' . sql_quote ($v);
}

function sql_append_assignment ($x, $k, $v, $padding = ', ')
{
    return $x . ($x ? $padding : '') . sql_assignment ($k, $v);
}

/**
 * Convert array to SQL assignment list.
 *
 * @access public
 * @param array $values Field values keyed by their names.
 * @returns string
 * @package Database interfaces
 */
function sql_assignments ($values, $padding = ', ')
{
    type_array ($values);

    $x = '';
    foreach ($values as $k => $v)
        if (!is_numeric ($k))
            $x = sql_append_assignment ($x, $k, $v, $padding);
    return $x;
}

?>
{'fraction_non_alphanumeric': 0.1743119266055046, 'fraction_numerical': 0.003669724770642202, 'mean_word_length': 3.138519924098672, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1939381', 'n_tokens_mistral': 772, 'n_tokens_neox': 757, 'n_words': 225}