diff --git a/.dockerignore b/.dockerignore index 7bd6c38..30e192f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,4 +5,5 @@ README* node_modules/ .* pnpm-lock* -dist \ No newline at end of file +dist +db_data \ No newline at end of file diff --git a/.gitignore b/.gitignore index 2619d2f..67ad81f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ node_modules pnpm-lock* dist *.db -*.sqlite* \ No newline at end of file +*.sqlite* +db_data \ No newline at end of file diff --git a/src/sqlConsoleCommands.ts b/src/sqlConsoleCommands.ts new file mode 100644 index 0000000..424e31b --- /dev/null +++ b/src/sqlConsoleCommands.ts @@ -0,0 +1,52 @@ +import { SqlSystem } from './sqlFunctions'; + +class SqlCommands { + + private static async InsertDummyData() { + console.log("Inserting random numbers into Pool"); + let dummy_auctionid: string[] = this.randomArray(10,8),dummy_lbin: number[] = this.randomArray(10,5); + await SqlSystem.Upsert(dummy_auctionid,dummy_lbin) + } + + private static async RequestDummyData() { + console.log("Requesting All from table auctions"); + console.log(await SqlSystem.Query("SELECT * FROM auctions")); + } + + public static async main(): Promise { + const command_args = process.argv.slice(2); + if(arguments.length===0) return; + switch(command_args[0].toString()) { + case "insdummy": { + this.InsertDummyData(); + break; + } + case "reqdummy": { + this.RequestDummyData(); + break; + } + default:break; + } + } + + private static randomArray(item_count: number,range_scale: number): any { + let random_array: any[] = []; + for(let i: number = 0;i { let conn: mariadb.PoolConnection | undefined;