Improve sql formatter tool

This commit is contained in:
Illya Marchenko 2023-12-15 13:17:36 +02:00
parent 2d4ec8c498
commit d3a281aab5
Signed by: stuzer05
GPG Key ID: A6ABAAA9268F9F4F

@ -22,12 +22,31 @@ export default {
data() { data() {
return { return {
toolData: { toolData: {
data: '', data: 'SELECT K.ID, SUM(DV.KOL*DV.TYPEMOVE) AS LK, K.TOVAR, KT.KATEGORY, K.CENAUSD, K.CENA, K.BESTBEFORE, K.KARTASER\n' +
' FROM $f" . "KARTA K, $f" . "DVIVTOV DV, TOVARY T, KATEG KT\n' +
' WHERE (K.SKLAD=$sklad) AND (K.TOVAR=T.TOVAR) AND (T.KATEGORY=KT.KATEGORY)\n' +
' AND (DV.NKARTA=K.ID)\n' +
' AND (DV.CURDATE < " . $conn->DBDate(ReversDateStrPar($operdata)) . ")\n' +
' AND (K.ID={$rs->fields[1]})\n' +
' GROUP BY K.ID, K.TOVAR, KT.KATEGORY, K.CENAUSD, K.CENA, K.BESTBEFORE, K.KARTASER\n' +
' HAVING SUM(DV.KOL*DV.TYPEMOVE)>=0.000001\n' +
' ORDER BY K.TOVAR;' +
'' +
'SELECT\n' +
' test\n' +
'FROM\n' +
' test t\n' +
'WHERE\n' +
' t.date <= to_date (\'" . date(\'Y-m-d\') . "\', \'YYYY-MM-DD\')\n' +
' and t.date <= to_date (\'" . date(\'Y-m-d\') . "\', \'YYYY-MM-DD\')',
minifyJson: '', minifyJson: '',
}, },
toolResult: '', toolResult: '',
}; };
}, },
mounted() {
this.result();
},
methods: { methods: {
result() { result() {
try { try {
@ -42,7 +61,7 @@ export default {
custom: [ custom: [
{ regex: String.raw`\{\$?[\w\d\->\[\]]+\}` }, { regex: String.raw`\{\$?[\w\d\->\[\]]+\}` },
{ regex: String.raw`\$[\w\d\->\[\]]+` }, { regex: String.raw`\$[\w\d\->\[\]]+` },
{ regex: String.raw`['"]\s?\..*\.\s?['"]` }, { regex: String.raw`['"].*['"]` },
], ],
positional: true, positional: true,
named: [':', '@'], named: [':', '@'],