Skip to content

Commit 49dbcd8

Browse files
committed
Adding comments back in.
1 parent 24f1cdd commit 49dbcd8

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

components/azure_sql/azure_sql.app.mjs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ export default {
6565
getConnection() {
6666
return sql.connect(this.getConfig());
6767
},
68+
/**
69+
* A helper method to get the schema of the database. Used by other features
70+
* (like the `sql` prop) to enrich the code editor and provide the user with
71+
* auto-complete and fields suggestion.
72+
*
73+
* @returns {DbInfo} The schema of the database, which is a
74+
* JSON-serializable object.
75+
*/
6876
async getSchema() {
6977
const sql = `
7078
SELECT t.TABLE_SCHEMA AS tableSchema,
@@ -97,6 +105,15 @@ export default {
97105
return acc;
98106
}, {});
99107
},
108+
/**
109+
* Adapts the arguments to `executeQuery` so that they can be consumed by
110+
* the SQL proxy (when applicable). Note that this method is not intended to
111+
* be used by the component directly.
112+
* @param {object} preparedStatement The prepared statement to be sent to the DB.
113+
* @param {string} preparedStatement.sql The prepared SQL query to be executed.
114+
* @param {string[]} preparedStatement.values The values to replace in the SQL query.
115+
* @returns {object} - The adapted query and parameters.
116+
*/
100117
proxyAdapter(preparedStatement = {}) {
101118
const { query } = preparedStatement;
102119
const inputs = preparedStatement?.inputs || {};
@@ -111,6 +128,16 @@ export default {
111128
params: [],
112129
};
113130
},
131+
/**
132+
* A method that performs the inverse transformation of `proxyAdapter`.
133+
*
134+
* @param {object} proxyArgs - The output of `proxyAdapter`.
135+
* @param {string} proxyArgs.query - The SQL query to be executed.
136+
* @param {string[]} proxyArgs.params - The values to replace in the SQL
137+
* query.
138+
* @returns {object} - The adapted query and parameters, compatible with
139+
* `executeQuery`.
140+
*/
114141
executeQueryAdapter(proxyArgs = {}) {
115142
let { query } = proxyArgs;
116143
const params = proxyArgs?.params || [];

0 commit comments

Comments
 (0)