vault backup: 2023-11-03 14:34:27

This commit is contained in:
Paul Trowbridge 2023-11-03 14:34:27 -04:00
parent 7a4e6b0260
commit cfa7960157
2 changed files with 4 additions and 2 deletions

4
api.ts
View File

@ -29,7 +29,7 @@ const client = new Client({
await client.connect(); await client.connect();
// Load SQL from file // Load SQL from file
const query = await Deno.readTextFile("sql/hist.sql"); const query = await Deno.readTextFile("sql/get.pg.sql");
// Define a route to retrieve values from the database using parameters // Define a route to retrieve values from the database using parameters
router.get('/price_info/part_cust/:partcode/:customer', async (ctx) => { router.get('/price_info/part_cust/:partcode/:customer', async (ctx) => {
@ -39,7 +39,7 @@ router.get('/price_info/part_cust/:partcode/:customer', async (ctx) => {
//console.log(partcode) //console.log(partcode)
//console.log(customer) //console.log(customer)
const result = await client.queryObject({args: [partcode, customer], text: query} ); const result = await client.queryObject({args: [customer, customer, partcode], text: query} );
ctx.response.body = result.rows; ctx.response.body = result.rows;
}); });

2
sql/get.pg.sql Normal file
View File

@ -0,0 +1,2 @@
--select gg.d from rlarp.get_guidance('DIAM0004','DIAM0004','AMK06000G18B054',5000,2024) gg(d);
select gg.d from rlarp.get_guidance($1,$2, $3, 5000,2024) gg(d);