<commit_before>import createSelect from './createSelect';

export default function createInsert(pool) {
	return (table, data) => new Promise((resolve, reject) => {
		pool.getConnection((err, conn) => {
			if (err) {
				return reject(err);
			}

			const query = `INSERT INTO ${table} SET ?`;
			conn.query(query, data, (err, result) => {
				conn.release();
				if (err) {
					return reject(err);
				}

				createSelect(pool)('user', result.insertId)
					.then(resolve)
					.catch(reject);
			});
		});
	});
}
<commit_msg>mysql: return only the inserted row<commit_after>import createSelect from './createSelect';

export default function createInsert(pool) {
	return (table, data) => new Promise((resolve, reject) => {
		pool.getConnection((err, conn) => {
			if (err) {
				return reject(err);
			}

			const query = `INSERT INTO ${table} SET ?`;
			conn.query(query, data, (err, result) => {
				conn.release();
				if (err) {
					return reject(err);
				}

				createSelect(pool)('user', result.insertId)
					.then(rows => resolve({ ...rows[0] }))
					.catch(reject);
			});
		});
	});
}

{'fraction_non_alphanumeric': 0.1781818181818182, 'fraction_numerical': 0.0009090909090909091, 'mean_word_length': 3.218390804597701, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '1061159', 'n_tokens_mistral': 442, 'n_tokens_neox': 357, 'n_words': 85}