<commit_before>cool-db-smf
===========

new db style for smf 2.xx

## Example ##

**old style**
```php
global $smcFunc;

$request = $smcFunc['db_query']('', '
    SELECT id_cat, cat_order
    FROM {db_prefix}categories',
    []
);
if ($smcFunc['db_num_rows']($request) == 0)
    return [];
while ($row = $smcFunc['db_fetch_assoc']($request))
{
    if ($row['id_cat'] != $category_id)
        $cats[] = $row['id_cat'];
    if ($row['id_cat'] == $catOptions['move_after'])
        $cats[] = $category_id;
    $cat_order[$row['id_cat']] = $row['cat_order'];
}
$smcFunc['db_free_result']($request);
```

**new style**
```php
use Inter\DB;

$request = DB::query('
    SELECT id_cat, cat_order
    FROM {db_prefix}categories',
    []
);
if (!$request->num_rows)
    return [];
while ($row = $request->fetch_assoc)
{
    if ($row['id_cat'] != $category_id)
        $cats[] = $row['id_cat'];
    if ($row['id_cat'] == $catOptions['move_after'])
        $cats[] = $category_id;
    $cat_order[$row['id_cat']] = $row['cat_order'];
}
$request->free;
```


<commit_msg>up README.md<commit_after>cool-db-smf
===========

new db style for smf 2.xx

## Example ##

**old style**
```php
global $smcFunc;

$request = $smcFunc['db_query']('', '
    SELECT id_cat, cat_order
    FROM {db_prefix}categories',
    []
);
if ($smcFunc['db_num_rows']($request) == 0)
    return [];
while ($row = $smcFunc['db_fetch_assoc']($request))
{
    # ...
    $cat_order[$row['id_cat']] = $row['cat_order'];
}
$smcFunc['db_free_result']($request);
```

**new style**
```php
use Inter\DB;

$request = DB::query('
    SELECT id_cat, cat_order
    FROM {db_prefix}categories',
    []
);
if (!$request->num_rows)
    return [];
while ($row = $request->fetch_assoc)
{
    # ...
    $cat_order[$row['id_cat']] = $row['cat_order'];
}
$request->free;
```



{'fraction_non_alphanumeric': 0.237465564738292, 'fraction_numerical': 0.0022038567493112946, 'mean_word_length': 4.115492957746479, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '3240120', 'n_tokens_mistral': 731, 'n_tokens_neox': 713, 'n_words': 123}