| 448 | } |
| 449 | |
| 450 | handleShowIndexesQuery(data) { |
| 451 | let currItem; |
| 452 | const result = []; |
| 453 | data.forEach(item => { |
| 454 | if (!currItem || currItem.name !== item.Key_name) { |
| 455 | currItem = { |
| 456 | primary: item.keyType === 'P', |
| 457 | fields: [], |
| 458 | name: item.name, |
| 459 | tableName: item.tableName, |
| 460 | unique: item.keyType === 'U', |
| 461 | type: item.type |
| 462 | }; |
| 463 | |
| 464 | _.forEach(item.COLNAMES.replace(/\+|-/g, x => { return ` ${ x}`; }).split(' '), column => { |
| 465 | let columnName = column.trim(); |
| 466 | if ( columnName ) { |
| 467 | columnName = columnName.replace(/\+|-/, ''); |
| 468 | currItem.fields.push({ |
| 469 | attribute: columnName, |
| 470 | length: undefined, |
| 471 | order: column.indexOf('-') === -1 ? 'ASC' : 'DESC', |
| 472 | collate: undefined |
| 473 | }); |
| 474 | } |
| 475 | }); |
| 476 | result.push(currItem); |
| 477 | } |
| 478 | }); |
| 479 | return result; |
| 480 | } |
| 481 | |
| 482 | handleInsertQuery(results, metaData) { |
| 483 | if (this.instance) { |