Initial upload with MSSQL and MariaDB implemented.

This commit is contained in:
2025-08-21 02:46:01 -04:00
commit 57430daf33
10 changed files with 3043 additions and 0 deletions

78
client.js Normal file
View File

@@ -0,0 +1,78 @@
// client.js
const axios = require('axios');
const generateUUID = require('uuid').v4;
async function testQuery(table, operation, params) {
try {
const response = await axios.post('http://localhost:3100/api/query', {
table,
operation,
params
});
console.log(response.data);
} catch (error) {
console.error('Error executing query:', error.response ? error.response.data : error.message);
}
}
// Example usage:
(async () => {
// CREATE: Ensure all required fields are present
const ID1 = generateUUID();
const ID2 = generateUUID();
const ID3 = generateUUID();
const ID4 = generateUUID();
await testQuery('Test', 'CREATE', {
Name: 'Test Item',
Text: 'A sample item created with ID: ' + ID1,
ID: ID1, // Assuming an ID is needed for identification or to prevent conflicts
// Add other necessary fields here based on your schema
});
await testQuery('Test', 'CREATE', {
Name: 'Test Item',
Text: 'A sample item created with ID: ' + ID2,
ID: ID2, // Assuming an ID is needed for identification or to prevent conflicts
// Add other necessary fields here based on your schema
});
await testQuery('Test', 'CREATE', {
Name: 'Test Item',
Text: 'A sample item created wth ID: ' + ID3,
ID: ID3, // Assuming an ID is needed for identification or to prevent conflicts
// Add other necessary fields here based on your schema
});
await testQuery('Test', 'CREATE', {
Name: 'Test Item',
Text: 'A sample item created with ID: ' + ID4,
ID: ID4, // Assuming an ID is needed for identification or to prevent conflicts
// Add other necessary fields here based on your schema
});
// UPDATE: Ensure both the ID and at least one field to update are present. ID must be the LAST field.
await testQuery('Test', 'UPDATE', {
Name: 'Tested item name',
Text: 'Updated item text successfully for item: ' + ID2,
ID: ID2
});
// READ: Ensure the ID is present
await testQuery('Test', 'READ', {
ID : ID1
} );
// READ: See all rows in a table
await testQuery('Test', 'READ');
// DELETE: Ensure the ID is present
await testQuery('Test', 'DELETE', {
ID: ID3
});
/*
// COMPARE: Ensure both compareTable and idField are present
const compareParams = {
compareTable: 'Test2',
idField: 'ID',
ID: '1'
};
await testQuery('Test', 'COMPARE', compareParams);*/
})();