LoginSignup
0
0

More than 1 year has passed since last update.

Julia: sqlite3 のデータを読む (Read)

Last updated at Posted at 2021-12-28

プログラム

sqlite3_read.jl
#! /usr/bin/julia
#
#	sqlite3_read.jl
#
#					Dec/27/2021
# --------------------------------------------------------------------
using SQLite
# --------------------------------------------------------------------
file_db = ARGS[1]
println("*** 開始 ***")
conn = SQLite.DB(file_db)

command = "select * from cities"

stmt = DBInterface.prepare(conn,command)

results = DBInterface.execute(stmt)

rowid = DBInterface.lastrowid(results)
for row in results
	print(row[1],'\t',row[2],'\t')
	println(row[3],'\t',row[4])
end
#
DBInterface.close!(stmt)
DBInterface.close!(conn)
#
println("*** 終了 ***")
# --------------------------------------------------------------------

確認したバージョン

$ julia --version
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