feat: add ability to see raw SQL results on test page
This commit is contained in:
@@ -68,10 +68,18 @@
|
||||
placeholder="Enter your SQL query here..."
|
||||
></textarea>
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<div class="mt-4 flex items-center gap-4">
|
||||
<button :class="primaryButtonClasses" @click="executeSql">
|
||||
Execute
|
||||
</button>
|
||||
<label class="flex items-center gap-2">
|
||||
<input
|
||||
v-model="returnRawResults"
|
||||
type="checkbox"
|
||||
class="rounded border-gray-300"
|
||||
/>
|
||||
<span class="text-sm">Return Raw Results</span>
|
||||
</label>
|
||||
</div>
|
||||
<div v-if="sqlResult" class="mt-4">
|
||||
<h3 class="text-lg font-semibold mb-2">Result:</h3>
|
||||
@@ -401,6 +409,7 @@ export default class Help extends Vue {
|
||||
// for SQL operations
|
||||
sqlQuery = "";
|
||||
sqlResult: unknown = null;
|
||||
returnRawResults = false;
|
||||
|
||||
cryptoLib = cryptoLib;
|
||||
|
||||
@@ -961,15 +970,28 @@ export default class Help extends Vue {
|
||||
* Supports both SELECT queries (dbQuery) and other SQL commands (dbExec)
|
||||
* Provides interface for testing raw SQL operations
|
||||
* Uses PlatformServiceMixin for database access and notification helpers for errors
|
||||
* When returnRawResults is true, uses direct platform service methods for unparsed results
|
||||
*/
|
||||
async executeSql() {
|
||||
try {
|
||||
const isSelect = this.sqlQuery.trim().toLowerCase().startsWith("select");
|
||||
if (isSelect) {
|
||||
this.sqlResult = await this.$query(this.sqlQuery);
|
||||
|
||||
if (this.returnRawResults) {
|
||||
// Use direct platform service methods for raw, unparsed results
|
||||
if (isSelect) {
|
||||
this.sqlResult = await this.$dbQuery(this.sqlQuery);
|
||||
} else {
|
||||
this.sqlResult = await this.$dbExec(this.sqlQuery);
|
||||
}
|
||||
} else {
|
||||
this.sqlResult = await this.$exec(this.sqlQuery);
|
||||
// Use methods that normalize the result objects
|
||||
if (isSelect) {
|
||||
this.sqlResult = await this.$query(this.sqlQuery);
|
||||
} else {
|
||||
this.sqlResult = await this.$exec(this.sqlQuery);
|
||||
}
|
||||
}
|
||||
|
||||
logger.log("Test SQL Result:", this.sqlResult);
|
||||
} catch (error) {
|
||||
logger.error("Test SQL Error:", error);
|
||||
|
||||
Reference in New Issue
Block a user