Deno で MariaDB のデータを削除 (Delete)
Deno で MariaDB のデータを削除します。
maria_delete.ts
// ---------------------------------------------------------------
// maria_delete.ts
//
// May/19/2020
//
// ---------------------------------------------------------------
import { Client } from "https://deno.land/x/mysql/mod.ts"
import { config } from "https://deno.land/x/dotenv/mod.ts"
// ---------------------------------------------------------------
function delete_command_gen (id_in:string)
{
const command:string = "delete from cities where id = '" + id_in + "'"
return command
}
// ---------------------------------------------------------------
console.log ("*** 開始 ***")
const config_env:any = config()
var id_in:string = Deno.args[0]
console.log (id_in)
const client = await new Client().connect({
hostname: "127.0.0.1",
username: config_env.user,
password: config_env.password,
db: config_env.data_base,
})
const command: string = delete_command_gen (id_in)
const result = await client.query(command)
console.log ("*** 終了 ***")
// ---------------------------------------------------------------
実行コマンド
deno run --allow-read --allow-net maria_delete.ts t3328
Author And Source
この問題について(Deno で MariaDB のデータを削除 (Delete)), 我々は、より多くの情報をここで見つけました https://qiita.com/ekzemplaro/items/9df72148ff05b02fd802著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .