| 462 | } |
| 463 | |
| 464 | handleShowIndexesQuery(data) { |
| 465 | let currItem; |
| 466 | const result = []; |
| 467 | data.forEach(item => { |
| 468 | if (!currItem || currItem.name !== item.Key_name) { |
| 469 | currItem = { |
| 470 | primary: item.keyType === 'P', |
| 471 | fields: [], |
| 472 | name: item.name, |
| 473 | tableName: item.tableName, |
| 474 | unique: item.keyType === 'U', |
| 475 | type: item.type |
| 476 | }; |
| 477 | |
| 478 | _.forEach(item.COLNAMES.replace(/\+|-/g, x => { return ` ${ x}`; }).split(' '), column => { |
| 479 | let columnName = column.trim(); |
| 480 | if ( columnName ) { |
| 481 | columnName = columnName.replace(/\+|-/, ''); |
| 482 | currItem.fields.push({ |
| 483 | attribute: columnName, |
| 484 | length: undefined, |
| 485 | order: column.indexOf('-') === -1 ? 'ASC' : 'DESC', |
| 486 | collate: undefined |
| 487 | }); |
| 488 | } |
| 489 | }); |
| 490 | result.push(currItem); |
| 491 | } |
| 492 | }); |
| 493 | return result; |
| 494 | } |
| 495 | |
| 496 | handleInsertQuery(results, metaData) { |
| 497 | if (this.instance) { |