|
|
@ -163,8 +163,14 @@ |
|
|
|
|
|
|
|
<div class="mt-8"> |
|
|
|
<h2 class="text-xl font-bold mb-4">SQL Operations</h2> |
|
|
|
<div class="mb-4"> |
|
|
|
<div class="flex gap-2 mb-2"> |
|
|
|
<div> |
|
|
|
<textarea |
|
|
|
v-model="sqlQuery" |
|
|
|
class="w-full h-32 p-2 border border-gray-300 rounded-md font-mono" |
|
|
|
placeholder="Enter your SQL query here..." |
|
|
|
></textarea> |
|
|
|
</div> |
|
|
|
<div class="flex gap-2 mt-2"> |
|
|
|
<button |
|
|
|
class="text-sm text-blue-600 hover:text-blue-800 underline" |
|
|
|
@click=" |
|
|
@ -174,14 +180,8 @@ |
|
|
|
All Tables |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
<textarea |
|
|
|
v-model="sqlQuery" |
|
|
|
class="w-full h-32 p-2 border border-gray-300 rounded-md font-mono" |
|
|
|
placeholder="Enter your SQL query here..." |
|
|
|
></textarea> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="mb-4"> |
|
|
|
<div class="mt-4"> |
|
|
|
<button |
|
|
|
class="font-bold capitalize bg-slate-500 text-white px-3 py-2 rounded-md mr-2" |
|
|
|
@click="executeSql" |
|
|
@ -307,7 +307,6 @@ import { AppString, NotificationIface } from "../constants/app"; |
|
|
|
import { db, retrieveSettingsForActiveAccount } from "../db/index"; |
|
|
|
import * as vcLib from "../libs/crypto/vc"; |
|
|
|
import * as cryptoLib from "../libs/crypto"; |
|
|
|
import databaseService from "../services/database"; |
|
|
|
|
|
|
|
import { |
|
|
|
PeerSetup, |
|
|
@ -323,6 +322,7 @@ import { |
|
|
|
SHARED_PHOTO_BASE64_KEY, |
|
|
|
} from "../libs/util"; |
|
|
|
import { logger } from "../utils/logger"; |
|
|
|
import { PlatformServiceFactory } from "@/services/PlatformServiceFactory"; |
|
|
|
const inputFileNameRef = ref<Blob>(); |
|
|
|
|
|
|
|
const TEST_PAYLOAD = { |
|
|
@ -535,12 +535,13 @@ export default class Help extends Vue { |
|
|
|
} |
|
|
|
|
|
|
|
async executeSql() { |
|
|
|
const platformService = PlatformServiceFactory.getInstance(); |
|
|
|
try { |
|
|
|
const isSelect = this.sqlQuery.trim().toLowerCase().startsWith("select"); |
|
|
|
if (isSelect) { |
|
|
|
this.sqlResult = await databaseService.query(this.sqlQuery); |
|
|
|
this.sqlResult = await platformService.dbQuery(this.sqlQuery); |
|
|
|
} else { |
|
|
|
this.sqlResult = await databaseService.run(this.sqlQuery); |
|
|
|
this.sqlResult = await platformService.dbExec(this.sqlQuery); |
|
|
|
} |
|
|
|
logger.log("SQL Result:", this.sqlResult); |
|
|
|
} catch (error) { |
|
|
|