21 Commits

Author SHA1 Message Date
Thorsten Muerell
917d77fa84 Fixed some bugs 2018-10-06 21:09:42 +02:00
Thorsten Muerell
5bb64db2fe Version bump 2018-02-26 11:22:20 +01:00
Thorsten Muerell
504e209202 Fixed some bugs 2018-02-26 11:22:02 +01:00
Thorsten Muerell
0d194a9e19 Fixed problems with delete 2017-11-21 23:02:02 +01:00
Thorsten Muerell
1ef2f9eb96 Better display 2017-11-15 11:57:56 +01:00
Thorsten Muerell
68740939fa Commit / Rollback 2017-11-14 00:47:17 +01:00
Thorsten Muerell
107a162370 Added commit and rollback 2017-11-14 00:46:10 +01:00
Thorsten Muerell
5a1c85aa04 Add commit and rollback 2017-11-14 00:17:05 +01:00
Thorsten Muerell
cd25b6a0f7 Bugfixes 2017-11-13 21:56:04 +01:00
Thorsten Muerell
ae2dfe3db1 Added icon 2017-11-13 21:33:26 +01:00
Thorsten Muerell
f6d05981a8 Version bump 2017-11-13 21:17:41 +01:00
Thorsten Muerell
217ced320f Improved session handling 2017-11-13 21:16:13 +01:00
Thorsten Muerell
4acb140b25 Version bump 2017-11-13 00:17:17 +01:00
Thorsten Muerell
8a1f942298 Fixed comments 2017-11-10 21:56:35 +01:00
Thorsten Muerell
da12eb698d Small fixes 2017-11-10 21:50:26 +01:00
Thorsten Muerell
85add9bb6b UTF-8 2017-11-09 13:46:49 +01:00
Thorsten Muerell
69eec45dc1 version bump 2017-11-08 15:58:06 +01:00
Thorsten Muerell
c684fa0c7c Added java home 2017-11-08 15:57:44 +01:00
Thorsten Muerell
2267d86f03 Configure Java Home 2017-11-08 15:36:51 +01:00
Thorsten Muerell
1e66025b23 Version dump 2017-11-07 09:11:01 +01:00
Thorsten Muerell
aed27e72be Small changes 2017-11-07 08:56:51 +01:00
14 changed files with 287 additions and 33 deletions

3
.gitignore vendored
View File

@@ -2,4 +2,5 @@ out
node_modules node_modules
.vscode-test/ .vscode-test/
*.vsix *.vsix
**/.DS_Store **/.DS_Store
npm-debug.log

View File

@@ -1,7 +1,35 @@
# Change Log # Change Log
All notable changes to the "frog" extension will be documented in this file. All notable changes to the "frog" extension will be documented in this file.
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. ## 0.0.25
## [Unreleased] - Fixed problems with deletes
- Initial release
## 0.0.24
- Better display of result set and values
## 0.0.23
- Added commit and rollback buttons
## 0.0.22
- Bugfixes
## 0.0.21
- Added icon
## 0.0.20
- Fixes for better session handling
## 0.0.19
- Maintenance release
## 0.0.18
- Fixed bug with endless loop

View File

@@ -31,4 +31,8 @@ To configure the available connections you can create a file named `.frog.json`
]} ]}
] ]
} }
``` ```
## Credits
Extension icon made by Smashicons from www.flaticon.com

Binary file not shown.

54
images/commit.svg Normal file
View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="474.8px" height="474.801px" viewBox="0 0 474.8 474.801" style="enable-background:new 0 0 474.8 474.801;"
xml:space="preserve">
<g>
<g>
<path d="M396.283,257.097c-1.14-0.575-2.282-0.862-3.433-0.862c-2.478,0-4.661,0.951-6.563,2.857l-18.274,18.271
c-1.708,1.715-2.566,3.806-2.566,6.283v72.513c0,12.565-4.463,23.314-13.415,32.264c-8.945,8.945-19.701,13.418-32.264,13.418
H82.226c-12.564,0-23.319-4.473-32.264-13.418c-8.947-8.949-13.418-19.698-13.418-32.264V118.622
c0-12.562,4.471-23.316,13.418-32.264c8.945-8.946,19.7-13.418,32.264-13.418H319.77c4.188,0,8.47,0.571,12.847,1.714
c1.143,0.378,1.999,0.571,2.563,0.571c2.478,0,4.668-0.949,6.57-2.852l13.99-13.99c2.282-2.281,3.142-5.043,2.566-8.276
c-0.571-3.046-2.286-5.236-5.141-6.567c-10.272-4.752-21.412-7.139-33.403-7.139H82.226c-22.65,0-42.018,8.042-58.102,24.126
C8.042,76.613,0,95.978,0,118.629v237.543c0,22.647,8.042,42.014,24.125,58.098c16.084,16.088,35.452,24.13,58.102,24.13h237.541
c22.647,0,42.017-8.042,58.101-24.13c16.085-16.084,24.134-35.45,24.134-58.098v-90.797
C402.001,261.381,400.088,258.623,396.283,257.097z"/>
<path d="M467.95,93.216l-31.409-31.409c-4.568-4.567-9.996-6.851-16.279-6.851c-6.275,0-11.707,2.284-16.271,6.851
L219.265,246.532l-75.084-75.089c-4.569-4.57-9.995-6.851-16.274-6.851c-6.28,0-11.704,2.281-16.274,6.851l-31.405,31.405
c-4.568,4.568-6.854,9.994-6.854,16.277c0,6.28,2.286,11.704,6.854,16.274l122.767,122.767c4.569,4.571,9.995,6.851,16.274,6.851
c6.279,0,11.704-2.279,16.274-6.851l232.404-232.403c4.565-4.567,6.854-9.994,6.854-16.274S472.518,97.783,467.95,93.216z"/>
</g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

10
images/commit_inverse.svg Normal file
View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="474.8" height="474.801" viewBox="0, 0, 474.8, 474.801">
<g id="Ebene_1">
<g>
<path d="M396.283,257.097 C395.143,256.522 394.001,256.235 392.85,256.235 C390.372,256.235 388.189,257.186 386.287,259.092 L368.013,277.363 C366.305,279.078 365.447,281.169 365.447,283.646 L365.447,356.159 C365.447,368.724 360.984,379.473 352.032,388.423 C343.087,397.368 332.331,401.841 319.768,401.841 L82.226,401.841 C69.662,401.841 58.907,397.368 49.962,388.423 C41.015,379.474 36.544,368.725 36.544,356.159 L36.544,118.622 C36.544,106.06 41.015,95.306 49.962,86.358 C58.907,77.412 69.662,72.94 82.226,72.94 L319.77,72.94 C323.958,72.94 328.24,73.511 332.617,74.654 C333.76,75.032 334.616,75.225 335.18,75.225 C337.658,75.225 339.848,74.276 341.75,72.373 L355.74,58.383 C358.022,56.102 358.882,53.34 358.306,50.107 C357.735,47.061 356.02,44.871 353.165,43.54 C342.893,38.788 331.753,36.401 319.762,36.401 L82.226,36.401 C59.576,36.401 40.208,44.443 24.124,60.527 C8.042,76.613 0,95.978 0,118.629 L0,356.172 C0,378.819 8.042,398.186 24.125,414.27 C40.209,430.358 59.577,438.4 82.227,438.4 L319.768,438.4 C342.415,438.4 361.785,430.358 377.869,414.27 C393.954,398.186 402.003,378.82 402.003,356.172 L402.003,265.375 C402.001,261.381 400.088,258.623 396.283,257.097 z" fill="#FFFFFF"/>
<path d="M467.95,93.216 L436.541,61.807 C431.973,57.24 426.545,54.956 420.262,54.956 C413.987,54.956 408.555,57.24 403.991,61.807 L219.265,246.532 L144.181,171.443 C139.612,166.873 134.186,164.592 127.907,164.592 C121.627,164.592 116.203,166.873 111.633,171.443 L80.228,202.848 C75.66,207.416 73.374,212.842 73.374,219.125 C73.374,225.405 75.66,230.829 80.228,235.399 L202.995,358.166 C207.564,362.737 212.99,365.017 219.269,365.017 C225.548,365.017 230.973,362.738 235.543,358.166 L467.947,125.763 C472.512,121.196 474.801,115.769 474.801,109.489 C474.801,103.209 472.518,97.783 467.95,93.216 z" fill="#FFFFFF"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
images/database.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

51
images/rollback.svg Normal file
View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="438.533px" height="438.533px" viewBox="0 0 438.533 438.533" style="enable-background:new 0 0 438.533 438.533;"
xml:space="preserve">
<g>
<path d="M409.133,109.203c-19.608-33.592-46.205-60.189-79.798-79.796C295.736,9.801,259.058,0,219.273,0
c-39.781,0-76.47,9.801-110.063,29.407c-33.595,19.604-60.192,46.201-79.8,79.796C9.801,142.8,0,179.489,0,219.267
c0,39.78,9.804,76.463,29.407,110.062c19.607,33.592,46.204,60.189,79.799,79.798c33.597,19.605,70.283,29.407,110.063,29.407
s76.47-9.802,110.065-29.407c33.593-19.602,60.189-46.206,79.795-79.798c19.603-33.596,29.403-70.284,29.403-110.062
C438.533,179.485,428.732,142.795,409.133,109.203z M322.621,270.939c3.617,3.613,5.428,7.905,5.428,12.854
c0,5.133-1.811,9.514-5.428,13.127l-25.693,25.701c-3.614,3.613-7.994,5.42-13.135,5.42c-4.948,0-9.236-1.807-12.847-5.42
l-51.676-51.682l-51.678,51.682c-3.616,3.613-7.898,5.42-12.847,5.42c-5.14,0-9.517-1.807-13.134-5.42l-25.697-25.701
c-3.616-3.613-5.424-7.994-5.424-13.127c0-4.948,1.809-9.24,5.424-12.854l51.678-51.673l-51.678-51.678
c-3.616-3.612-5.424-7.898-5.424-12.847c0-5.14,1.809-9.517,5.424-13.134l25.697-25.693c3.617-3.616,7.994-5.424,13.134-5.424
c4.949,0,9.231,1.809,12.847,5.424l51.678,51.674l51.676-51.674c3.61-3.616,7.898-5.424,12.847-5.424
c5.141,0,9.521,1.809,13.135,5.424l25.693,25.693c3.617,3.617,5.428,7.994,5.428,13.134c0,4.948-1.811,9.235-5.428,12.847
l-51.675,51.678L322.621,270.939z"/>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="438.533" height="438.533" viewBox="0, 0, 438.533, 438.533">
<g id="Ebene_1">
<path d="M409.133,109.202 C389.525,75.61 362.928,49.013 329.335,29.406 C295.736,9.8 259.059,-0.001 219.273,-0.001 C179.492,-0.001 142.803,9.8 109.21,29.406 C75.615,49.01 49.018,75.607 29.41,109.202 C9.801,142.799 0,179.488 0,219.266 C0,259.047 9.804,295.729 29.407,329.328 C49.014,362.921 75.611,389.517 109.206,409.126 C142.803,428.732 179.49,438.534 219.27,438.534 C259.049,438.534 295.74,428.732 329.335,409.126 C362.927,389.525 389.523,362.921 409.129,329.328 C428.732,295.732 438.533,259.044 438.533,219.266 C438.534,179.484 428.732,142.794 409.133,109.202 z M322.621,270.939 C326.238,274.551 328.049,278.844 328.049,283.792 C328.049,288.926 326.238,293.306 322.621,296.919 L296.928,322.62 C293.314,326.233 288.935,328.04 283.793,328.04 C278.845,328.04 274.557,326.233 270.947,322.62 L219.27,270.939 L167.592,322.62 C163.977,326.233 159.694,328.04 154.745,328.04 C149.605,328.04 145.229,326.233 141.611,322.62 L115.914,296.919 C112.298,293.306 110.49,288.926 110.49,283.792 C110.49,278.844 112.299,274.552 115.914,270.939 L167.592,219.265 L115.914,167.587 C112.298,163.975 110.49,159.689 110.49,154.74 C110.49,149.6 112.299,145.223 115.914,141.606 L141.611,115.913 C145.229,112.297 149.605,110.489 154.745,110.489 C159.694,110.489 163.977,112.298 167.592,115.913 L219.27,167.587 L270.947,115.913 C274.556,112.297 278.844,110.489 283.793,110.489 C288.935,110.489 293.314,112.298 296.928,115.913 L322.621,141.606 C326.238,145.223 328.049,149.6 328.049,154.74 C328.049,159.688 326.238,163.975 322.621,167.587 L270.947,219.265 L322.621,270.939 z" fill="#FFFFFF"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -1,9 +1,9 @@
{ {
"name": "frog", "name": "frog",
"displayName": "frog", "displayName": "Frog",
"description": "The Oracle SQL workbench for VSCode", "description": "The Oracle SQL workbench for VSCode",
"version": "0.0.14", "version": "0.0.28",
"publisher": "todie", "publisher": "tmuerell",
"engines": { "engines": {
"vscode": "^1.17.0" "vscode": "^1.17.0"
}, },
@@ -15,24 +15,49 @@
"onLanguage:plsql", "onLanguage:plsql",
"onView:connections" "onView:connections"
], ],
"icon": "images/database.png",
"main": "./out/extension", "main": "./out/extension",
"contributes": { "contributes": {
"commands": [ "commands": [
{ {
"command": "frog.executeSnippet", "command": "frog.executeSnippet",
"title": "Execute SQL Snippet" "title": "Frog: Execute SQL Snippet"
}, },
{ {
"command": "frog.compileFile", "command": "frog.compileFile",
"title": "Compiles the current file" "title": "Frog: Compiles the current file"
},
{
"command": "frog.commit",
"title": "Frog: Commits the current transaction",
"icon": {
"light": "images/commit.svg",
"dark": "images/commit_inverse.svg"
}
},
{
"command": "frog.rollback",
"title": "Frog: Rollbacks",
"icon": {
"light": "images/rollback.svg",
"dark": "images/rollback_inverse.svg"
}
},
{
"command": "frog.checkConnection",
"title": "Frog: Checks the connection"
}, },
{ {
"command": "frog.selectConnection", "command": "frog.selectConnection",
"title": "Selects the connection to use" "title": "Frog: Selects the connection to use"
}, },
{ {
"command": "frog.setRowLimit", "command": "frog.setRowLimit",
"title": "Sets the row limit" "title": "Frog: Sets the row limit"
},
{
"command": "frog.chooseConnection",
"title": "Frog: Choose a connection to use"
} }
], ],
"keybindings": [ "keybindings": [
@@ -46,7 +71,6 @@
"key": "ctrl+alt+c", "key": "ctrl+alt+c",
"mac": "ctrl+alt+c" "mac": "ctrl+alt+c"
} }
], ],
"views": { "views": {
"explorer": [ "explorer": [
@@ -73,7 +97,36 @@
"scopeName": "code.log", "scopeName": "code.log",
"path": "./syntaxes/frog-runner.tmLanguage" "path": "./syntaxes/frog-runner.tmLanguage"
} }
] ],
"menus": {
"editor/title": [
{
"command": "frog.commit",
"group": "navigation"
},
{
"command": "frog.rollback",
"group": "navigation"
}
]
},
"configuration": {
"type": "object",
"title": "Frog configuration",
"properties": {
"frog.javaHome": {
"type": "string",
"default": "",
"description": "Set the java home to use for the runner."
},
"frog.resultSetStyles": {
"type": "string",
"default": "",
"description": "Set additional CSS styles for the result set viewer (Example: 'td { color: red; }')"
}
}
}
}, },
"scripts": { "scripts": {
"vscode:prepublish": "npm run compile", "vscode:prepublish": "npm run compile",

View File

@@ -29,7 +29,7 @@ export class BlockDetector {
} }
} else { } else {
while (!endLine.text.match(/;/) && endLine.lineNumber < doc.lineCount-1) { while (!endLine.text.match(/;/) && endLine.lineNumber < doc.lineCount-1) {
endLine = this.editor.document.lineAt(startLine.lineNumber+1) endLine = this.editor.document.lineAt(endLine.lineNumber+1)
} }
} }

View File

@@ -49,6 +49,21 @@ export function activate(context: vscode.ExtensionContext) {
}); });
context.subscriptions.push(disposable); context.subscriptions.push(disposable);
disposable = vscode.commands.registerCommand('frog.commit', () => {
sessionManager.execute("commit", 0);
});
context.subscriptions.push(disposable);
disposable = vscode.commands.registerCommand('frog.rollback', () => {
sessionManager.execute("rollback", 0);
});
context.subscriptions.push(disposable);
disposable = vscode.commands.registerCommand('frog.checkConnection', () => {
sessionManager.execute("select 1 from dual", 1);
});
context.subscriptions.push(disposable);
function changeSession(node: ConnectionNode) { function changeSession(node: ConnectionNode) {
sessionManager.currentConnection = node; sessionManager.currentConnection = node;
} }
@@ -59,7 +74,7 @@ export function activate(context: vscode.ExtensionContext) {
}); });
context.subscriptions.push(disposable); context.subscriptions.push(disposable);
vscode.commands.registerCommand('frog.selectConnection', (node: ConnectionNode) => { disposable = vscode.commands.registerCommand('frog.selectConnection', (node: ConnectionNode) => {
if (!sessionManager.isSessionActive()) { if (!sessionManager.isSessionActive()) {
sessionManager.currentConnection = node; sessionManager.currentConnection = node;
} else { } else {
@@ -71,6 +86,17 @@ export function activate(context: vscode.ExtensionContext) {
}, (reason) => {}) }, (reason) => {})
} }
}) })
context.subscriptions.push(disposable);
disposable = vscode.commands.registerCommand('frog.chooseConnection', () => {
vscode.window.showQuickPick(["A", "B", "C"])
.then( (selection) => {
if (selection == 'Yes') {
console.log(selection);
}
}, (reason) => {})
})
context.subscriptions.push(disposable);
} }
// this method is called when your extension is deactivated // this method is called when your extension is deactivated

View File

@@ -6,13 +6,19 @@ export class TextDocumentContentProvider implements vscode.TextDocumentContentPr
public provideTextDocumentContent(uri: vscode.Uri): string { public provideTextDocumentContent(uri: vscode.Uri): string {
if (!this._data) return this.errorSnippet(); if (!this._data) return this.errorSnippet();
if (this._data['rows'].length == 0) return this.errorSnippet();
const configuration = vscode.workspace.getConfiguration('frog')
const additionalStyles = configuration.get("resultSetStyles", "")
let styles = `<style> let styles = `<style>
table { table {
border-collapse: collapse; border-collapse: collapse;
} }
table td, table th { table td, table th {
padding: 3px; padding: 2px;
font-size: 11px;
white-space: nowrap;
} }
tr:hover { tr:hover {
background-color: #aaaa66; background-color: #aaaa66;
@@ -30,6 +36,9 @@ export class TextDocumentContentProvider implements vscode.TextDocumentContentPr
.vscode-dark #limitBox a { .vscode-dark #limitBox a {
color: white; color: white;
} }
.vscode-dark table td.value-null {
background-color: #666600;
}
.vscode-light table { .vscode-light table {
border: solid 1px black; border: solid 1px black;
@@ -40,6 +49,11 @@ export class TextDocumentContentProvider implements vscode.TextDocumentContentPr
.vscode-light #limitBox a { .vscode-light #limitBox a {
color: black; color: black;
} }
.vscode-light table td.value-null {
background-color: #cccc33;
}
${additionalStyles}
</style>` </style>`
const choosableLimits = [2,10,50] const choosableLimits = [2,10,50]
@@ -51,7 +65,7 @@ export class TextDocumentContentProvider implements vscode.TextDocumentContentPr
text += this._data['columnDefinitions'].map((x) => `<th>${x['name']}</th>`).join('') text += this._data['columnDefinitions'].map((x) => `<th>${x['name']}</th>`).join('')
text += '</tr>' text += '</tr>'
text += this._data['rows'].map((r) => text += this._data['rows'].map((r) =>
'<tr>' + r['columns'].map((c) => '<td>' + c['value'] + '</td>').join('') + '</tr>' '<tr>' + r['columns'].map((c) => '<td class="' + (c['value'] == null ? 'value-null' : 'value-value') + '">' + (c['value'] == null ? 'NULL' : c['value']) + '</td>').join('') + '</tr>'
).join('') ).join('')
text += '</table></body>' text += '</table></body>'
return text; return text;
@@ -74,12 +88,7 @@ export class TextDocumentContentProvider implements vscode.TextDocumentContentPr
<body> <body>
<table> <table>
<tr> <tr>
<th>ID</th> <td>No results found!</td>
<th>Name</th>
</tr>
<tr>
<td>1</td>
<td>Foobar</td>
</tr> </tr>
</table> </table>
</body>`; </body>`;

View File

@@ -2,6 +2,7 @@ import * as vscode from 'vscode';
import { ConnectionNode } from './connections' import { ConnectionNode } from './connections'
import { spawn } from 'child_process' import { spawn } from 'child_process'
import { TextDocumentContentProvider } from './resultsetview' import { TextDocumentContentProvider } from './resultsetview'
import * as path from 'path'
const extensionName = "frog"; const extensionName = "frog";
const previewUri = vscode.Uri.parse('frog-view://authority/resultset'); const previewUri = vscode.Uri.parse('frog-view://authority/resultset');
@@ -49,7 +50,7 @@ export class SessionManager {
if (!this.dbSession) return; if (!this.dbSession) return;
this.dbSession.stdin.end(); this.dbSession.stdin.end();
this.dbSession = null; this.dbSession.kill();
} }
public check() : boolean { public check() : boolean {
@@ -58,8 +59,18 @@ export class SessionManager {
return false; return false;
} }
let extPath = vscode.extensions.getExtension("todie.frog").extensionPath; if (this.dbSession) {
this.dbSession = spawn("java", ['-jar', extPath + '/frog-runner.jar', this.currentConnection.host, this.currentConnection.port.toString(), this.currentConnection.schema, this.currentConnection.username, this.currentConnection.password]); return true;
}
let extPath = vscode.extensions.getExtension("tmuerell.frog").extensionPath;
const configuration = vscode.workspace.getConfiguration('frog')
const javaHome = configuration.get("javaHome", "")
let java = "java";
if (javaHome) {
java = path.join(javaHome, 'bin', 'java')
}
this.dbSession = spawn(java, ['-Dfile.encoding=UTF-8', '-jar', extPath + '/frog-runner.jar', this.currentConnection.host, this.currentConnection.port.toString(), this.currentConnection.schema, this.currentConnection.username, this.currentConnection.password]);
let outputBuffer = ""; let outputBuffer = "";
@@ -69,6 +80,8 @@ export class SessionManager {
try { try {
let json = JSON.parse(outputBuffer); let json = JSON.parse(outputBuffer);
const editor = vscode.window.activeTextEditor;
const document = editor.document;
const diagnostics = []; const diagnostics = [];
let cd = json['columnDefinitions'] let cd = json['columnDefinitions']
@@ -79,9 +92,6 @@ export class SessionManager {
if (json['userErrors']) { if (json['userErrors']) {
this.outputChannel.append("Errors found:\n"); this.outputChannel.append("Errors found:\n");
const editor = vscode.window.activeTextEditor;
const document = editor.document;
for (let error of json['userErrors'][0]['lines']) { for (let error of json['userErrors'][0]['lines']) {
let range = document.lineAt(editor.selection.start.line + error['line'] - 1).range; let range = document.lineAt(editor.selection.start.line + error['line'] - 1).range;
let diagnostic = new vscode.Diagnostic(range, error['text'], vscode.DiagnosticSeverity.Error); let diagnostic = new vscode.Diagnostic(range, error['text'], vscode.DiagnosticSeverity.Error);
@@ -91,12 +101,12 @@ export class SessionManager {
this.outputChannel.append(error['line'] + ": " + error['text'] + "\n"); this.outputChannel.append(error['line'] + ": " + error['text'] + "\n");
} }
this.diagnosticCollection.set(document.uri, diagnostics);
} else if (json['exception']) { } else if (json['exception']) {
this.outputChannel.append("Exception caught: " + json['exceptionMessage'] + "\n"); this.outputChannel.append("Exception caught: " + json['exceptionMessage'] + "\n");
} else if ("affectedRows" in json) { } else if ("affectedRows" in json) {
this.outputChannel.append(json['affectedRows'] + " rows affected.\n"); this.outputChannel.append(json['affectedRows'] + " rows affected.\n");
} else { } else {
vscode.window.showInformationMessage('Query executed successfully.');
this.outputChannel.append("SQL executed successfully.\n"); this.outputChannel.append("SQL executed successfully.\n");
} }
} else { } else {
@@ -111,7 +121,8 @@ export class SessionManager {
this.outputChannel.append("Query successful.\n"); this.outputChannel.append("Query successful.\n");
} }
this.outputChannel.append("-- " + new Date() + " -------------------------------\n"); this.diagnosticCollection.set(document.uri, diagnostics);
this.outputChannel.append("-- end@" + this.currentConnection.name + " " + new Date() + " -------------------------------\n");
outputBuffer = ""; outputBuffer = "";
this.statusBarItem.text = this.currentConnection.name + " (Connected)"; this.statusBarItem.text = this.currentConnection.name + " (Connected)";
} catch (e) { } catch (e) {
@@ -136,7 +147,7 @@ export class SessionManager {
public execute(text : string, rowLimit : number) { public execute(text : string, rowLimit : number) {
if (!this.check()) return; if (!this.check()) return;
this.outputChannel.append("-- " + new Date() + " -------------------------------\n"); //Executing: '" + text + "'\n"); this.outputChannel.append("-- begin@" + this.currentConnection.name + " " + new Date() + " -------------------------------\n");
let input = { "sql": text, "rowLimit": rowLimit }; let input = { "sql": text, "rowLimit": rowLimit };
this.dbSession.stdin.write(JSON.stringify(input) + "\n--- END ---\n"); this.dbSession.stdin.write(JSON.stringify(input) + "\n--- END ---\n");
this.statusBarItem.text = this.currentConnection.name + " (Connected, Query running...)"; this.statusBarItem.text = this.currentConnection.name + " (Connected, Query running...)";