drapcode-utility 2.4.7 → 2.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/utils/rest-client.js +10 -1
- package/package.json +1 -1
|
@@ -297,7 +297,7 @@ const makeMySqlCall = async (projectId, data, extDbSetting) => {
|
|
|
297
297
|
const allowedOps = ["select", "insert", "update", "delete"];
|
|
298
298
|
let result = "";
|
|
299
299
|
try {
|
|
300
|
-
const { sql: sqlQuery, params: sqlParams = [], pagination: sqlPagination, sort: sqlSort, searchQuery } = data || {};
|
|
300
|
+
const { sql: sqlQuery, params: sqlParams = [], pagination: sqlPagination, files: sqlFiles = [], sort: sqlSort, searchQuery } = data || {};
|
|
301
301
|
if (!sqlQuery || !sqlQuery.trim()) {
|
|
302
302
|
return { status: 400, error: "SQL Query is empty" };
|
|
303
303
|
}
|
|
@@ -316,6 +316,15 @@ const makeMySqlCall = async (projectId, data, extDbSetting) => {
|
|
|
316
316
|
finalSql += (0, util_1.buildOrderByClause)(sqlSort);
|
|
317
317
|
// Add LIMIT/OFFSET clause
|
|
318
318
|
finalSql += (0, util_1.buildLimitOffsetClause)(sqlPagination, values);
|
|
319
|
+
// Add Files if any in values
|
|
320
|
+
if (sqlFiles && sqlFiles.length > 0) {
|
|
321
|
+
sqlFiles.forEach((fileObj) => {
|
|
322
|
+
console.log("🚀 ~ makeMySqlCall ~ fileObj:", fileObj);
|
|
323
|
+
const fileData = fileObj && fileObj !== 'null' ? Buffer.from(fileObj, 'base64') : null;
|
|
324
|
+
console.log("🚀 ~ makeMySqlCall ~ fileData:", fileData);
|
|
325
|
+
values.push(fileData);
|
|
326
|
+
});
|
|
327
|
+
}
|
|
319
328
|
const { mysqlDbHostUrl, mysqlDbUser, mysqlDbPassword, mysqlDbName, mysqlDbPort } = extDbSetting || {};
|
|
320
329
|
const mysqlDBConfig = {
|
|
321
330
|
host: mysqlDbHostUrl,
|