<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

# this row must be existent
#cur.execute("insert into person values ('dara', '<NAME>')")

# test PostgreSQL
import psycopg2 as db
from mosql.util import escape
conn = db.connect(database='mosky')

# or MySQL
#import MySQLdb as db
#from mosql.mysql import escape
#conn = db.connect(user='root', db='mosky')

# --- main ---

cur = conn.cursor()

bytes = ''.join(unichr(i) for i in range(1, 128)).encode('utf-8')
bytes += ''.join(unichr(i) for i in range(28204, 28224)).encode('utf-8')

cur.execute("update person set name='%s' where person_id='dara'" % escape(bytes))
conn.commit()

cur.execute("select name from person where person_id='dara'")

for row in cur:<commit_msg>added fast_escape in test_escape<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

# this row must be existent
#cur.execute("insert into person values ('dara', '<NAME>')")

# test PostgreSQL
import psycopg2 as db
from mosql.util import escape
conn = db.connect(database='mosky')

# or MySQL
#import MySQLdb as db
#from mosql.mysql import escape
#from mosql.mysql import fast_escape as escape
#conn = db.connect(user='root', db='mosky')

# --- main ---

cur = conn.cursor()

bytes = ''.join(unichr(i) for i in range(1, 128)).encode('utf-8')
bytes += ''.join(unichr(i) for i in range(28204, 28224)).encode('utf-8')

cur.execute("update person set name='%s' where person_id='dara'" % escape(bytes))
conn.commit()

cur.execute("select name from person where person_id='dara'")

for row in cur:
{'fraction_non_alphanumeric': 0.17232375979112272, 'fraction_numerical': 0.02349869451697128, 'mean_word_length': 4.784905660377358, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1509155', 'n_tokens_mistral': 561, 'n_tokens_neox': 534, 'n_words': 158}