UWCodeForce / student-net

https://uwcodeforce.ca
2 stars 11 forks source link

Change SQL result object to remove field data #48

Closed xTrig closed 2 years ago

xTrig commented 2 years ago

Right now a lot of our codebase uses samples such as the one below.

var results = await query('SELECT * FROM something');

What this does is actually return an array with our results[] inside of it, along with our field data. We don't want this, and this can cause some issues when checking if results.length > 0 (which it always will be).

We need to change all occurences to

var [results] = await query('SELECT * FROM something');

So we strip the extra data we don't want, preventing some headaches in the future.

Raghuboi commented 2 years ago

will get this fixed right away