LoginSignup
0
0

More than 1 year has passed since last update.

Julia: MariaDB のデータを更新 (Update)

Last updated at Posted at 2021-12-26

プログラム

フォルダー構造

$ tree -a
.
├── .env
├── config_mariadb.jl
└── maria_update.jl
maria_update.jl
#! /usr/bin/julia
#
#	maria_update.jl
#
#						Feb/24/2023
# --------------------------------------------------------------------
using MySQL
include("config_mariadb.jl")
# --------------------------------------------------------------------
println(stderr,"*** 開始 ***")
key_in = ARGS[1]
population_in = ARGS[2]
println(key_in,'\t',population_in)
#
today = Libc.strftime("%F", time())
println(today)

host, user, password, data_base = config_mariadb_proc()
conn =DBInterface.connect(MySQL.Connection, host, user, password)

command = "update " * data_base * ".cities" * " set population = " * population_in
command *= " , date_mod = '" * today * "'"
command *= " where id = '" * key_in * "'"
println(command)
#
results = DBInterface.execute(conn,command)
println(results)
#
DBInterface.close!(conn)
#
println(stderr,"*** 終了 ***")
# --------------------------------------------------------------------

.env
config_mariadb.jl
はこちら
Julia: MariaDB のバージョンを表示

確認したバージョン

$ julia -v
julia version 1.8.5
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0