{"id":181,"date":"2024-03-06T08:32:04","date_gmt":"2024-03-05T23:32:04","guid":{"rendered":"https:\/\/shirakawa.weblike.jp\/blog-page\/?p=181"},"modified":"2025-08-09T12:00:53","modified_gmt":"2025-08-09T03:00:53","slug":"sqlite","status":"publish","type":"post","link":"https:\/\/shirakawa.weblike.jp\/blog-page\/2024\/03\/06\/sqlite\/","title":{"rendered":"SQLite"},"content":{"rendered":"<p>GoLang\u3067SQLite\u3092\u4f7f\u3044\u305f\u3044\u306e\u3067\u3001Install\u3059\u308b\u3002<\/p>\n<p>$ ls -l \/mnt2\/slackware64\/*\/*sqlite*.txz<br \/>\n\\-rw-r&#8211;r&#8211; 1 root root 1030596 1\u6708 7 2022 \/mnt2\/slackware64\/ap\/sqlite-3.37.2-x86_64-1.txz<br \/>\n$ sudo installpkg \/mnt2\/slackware64\/ap\/sqlite-3.37.2-x86_64-1.txz<br \/>\n(\u30e1\u30e2\u7701\u7565)<br \/>\n$ grep -E &#8216;bin|lib&#8217; \/var\/log\/packages\/sqlite-3.37.2-x86_64-1 | sed s@^@\/@ | xargs ldd | grep found<br \/>\n(\u4f9d\u5b58\u306e\u4e0d\u8db3\u306f\u7121\u304b\u3063\u305f)<\/p>\n<p>SQLite\u306f\u7d44\u307f\u8fbc\u307f\u5f0f DB\u306a\u306e\u3067\u3001Go\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u5074\u3067\u7528\u610f\u3057\u3066\u3042\u308b\u306f\u305a\u306a\u306e\u3067\u3001\u8981\u3089\u306a\u304b\u3063\u305f?\u3002<br \/>\nDB\u3092\u4f5c\u6210\u3057\u305f\u308a\u3001DB\u306e\u4e2d\u8eab\u3092\u898b\u308b\u30b3\u30de\u30f3\u30c9\u3068\u304b\u3067\u4f7f\u3046\u304b\u3002<br \/>\n\u4ee5\u524d\u4f5c\u3063\u305f\u3001\u304a\u554f\u3044\u5408\u308f\u305bTable\u3068\u540c\u3058\u69d8\u306a\u306e\u3092\u3001phpMyAdmin\u3092\u898b\u306a\u304c\u3089\u4f5c\u3063\u3066\u307f\u308b\u3002<br \/>\n$ sqlite3 smp001.db<br \/>\nSQLite version 3.37.2 2022-01-06 13:25:41<br \/>\nEnter &#8220;.help&#8221; for usage hints.<br \/>\nsqlite&gt; create table if not exists mst_message ( code integer primary key autoincrement, name text not null, email text not null, message text not null);<br \/>\nsqlite&gt; .tables<br \/>\nmst_message<br \/>\nsqlite&gt; insert into mst_message ( name, email, message) values (&#8216;test&#8217;, &#8216;test@test.jp&#8217;, &#8216;this is test&#8217;);<br \/>\nsqlite&gt; select * from mst_message;<br \/>\n1|test|test@test.jp|this is test<br \/>\nsqlite&gt; .exit<\/p>\n<p>Go\u5074\u306bgo-sqlite3\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3002<br \/>\n$ export PATH=$PATH:\/usr\/local\/go\/bin<br \/>\n$ export GOPATH=~\/go<br \/>\n$ go mod init example.net\/myproj\/oldcygwin\/practice800\/practice820<br \/>\ngo: creating new go.mod: module example.net\/myproj\/oldcygwin\/practice800\/practice820<br \/>\ngo: to add module requirements and sums:<br \/>\n\\ go mod tidy<br \/>\n$ go get github.com\/mattn\/go-sqlite3<br \/>\ngo: downloading github.com\/mattn\/go-sqlite3 v1.14.22<br \/>\ngo: added github.com\/mattn\/go-sqlite3 v1.14.22<\/p>\n<p>&nbsp;<\/p>\n<p>\u53c2\u8003AI\uff1a<br \/>\nhttps:\/\/chat.openai.com\/auth\/login<br \/>\n\u4ee5\u4e0b\u306eGo\u8a00\u8a9e\u306b\u3064\u3044\u3066\u3001SQLite\u3092\u4f7f\u3046\u8a18\u8ff0\u306b\u5909\u66f4<br \/>\nSQLite\u3067\u3001primary key \u3092\u30b3\u30de\u30f3\u30c9\u3067\u8a2d\u5b9a\u3059\u308b\u65b9\u6cd5\u306f\uff1f<br \/>\n\u30c6\u30fc\u30d6\u30eb\u306e\u5185\u5bb9\u3092\u8868\u793a\u3059\u308b\u30b3\u30de\u30f3\u30c9\u306f\uff1f<\/p>\n<p>\u53c2\u8003URL\uff1a<br \/>\nsqlite3 \u30b3\u30de\u30f3\u30c9 db\u4f5c\u6210\u3001\u3067\u30b0\u30b0\u3063\u305f\uff1a<br \/>\nhttps:\/\/www.javadrive.jp\/sqlite\/database\/index1.html<br \/>\nsqlite3 \u30b3\u30de\u30f3\u30c9\u3001\u3067\u30b0\u30b0\u3063\u305f\uff1a<br \/>\nhttps:\/\/qiita.com\/ChiakiYamaoka\/items\/b7c7863688d6f23c0501<\/p>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u6642\u306e\u8aac\u660e\uff1a<br \/>\n# sqlite (simple, self contained database engine)<br \/>\n# SQLite is a small C library that implements a self-contained,<br \/>\n# embeddable, zero-configuration SQL database engine.<br \/>\n# The SQLite distribution comes with a standalone command-line access<br \/>\n# program (sqlite) that can be used to administer an SQLite database<br \/>\n# and which serves as an example of how to use the SQLite library.<br \/>\n# Homepage: http:\/\/www.sqlite.org\/<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GoLang\u3067SQLite\u3092\u4f7f\u3044\u305f\u3044\u306e\u3067\u3001Install\u3059\u308b\u3002 $ ls -l \/mnt2\/slackware64\/*\/*sqlite*.txz \\-rw-r&#8211;r&#8211; 1 root root 103 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-181","post","type-post","status-publish","format-standard","hentry","category-web-practice"],"_links":{"self":[{"href":"https:\/\/shirakawa.weblike.jp\/blog-page\/wp-json\/wp\/v2\/posts\/181","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shirakawa.weblike.jp\/blog-page\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shirakawa.weblike.jp\/blog-page\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shirakawa.weblike.jp\/blog-page\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/shirakawa.weblike.jp\/blog-page\/wp-json\/wp\/v2\/comments?post=181"}],"version-history":[{"count":4,"href":"https:\/\/shirakawa.weblike.jp\/blog-page\/wp-json\/wp\/v2\/posts\/181\/revisions"}],"predecessor-version":[{"id":1492,"href":"https:\/\/shirakawa.weblike.jp\/blog-page\/wp-json\/wp\/v2\/posts\/181\/revisions\/1492"}],"wp:attachment":[{"href":"https:\/\/shirakawa.weblike.jp\/blog-page\/wp-json\/wp\/v2\/media?parent=181"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shirakawa.weblike.jp\/blog-page\/wp-json\/wp\/v2\/categories?post=181"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shirakawa.weblike.jp\/blog-page\/wp-json\/wp\/v2\/tags?post=181"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}