Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 1x 1x 1x 1x | // Previously keys and values were parsed from the error string, but the // presence of commas in the values section messed it up. So now, it // returns just gets the keys from the error message and gets the values // from the business object (previously did not accept a business object). const getColumnsValuesFromInsertErrorOLD = (error = '') => { let keys, values; try { const results = /.*Key.*\((.*)\)=.*\((.*)\).*/g.exec(error); const [, keyString, valueString] = results; keys = keyString.split(', '); values = valueString.split(', '); } catch (_err) {} return [keys, values]; }; void getColumnsValuesFromInsertErrorOLD; const getColumnsValuesFromInsertError = (error = '', bo) => { let keys, values; try { const results = /.*Key.*\((.*)\)=.*\((.*)\).*/g.exec(error); const [, keyString] = results; keys = keyString.split(', '); values = keys.map(key => bo.getValueBySqlColumn(key)); } catch (_err) {} return [keys, values]; }; module.exports.getColumnsValuesFromInsertError = getColumnsValuesFromInsertError; |