Skip to content

Commit

Permalink
Site updated: 2024-02-28 16:45:42
Browse files Browse the repository at this point in the history
  • Loading branch information
jjppp committed Feb 28, 2024
1 parent cf75184 commit 1839ae5
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
Binary file added 2024/02/05/DB03-SQL/eSQL.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 27 additions & 1 deletion 2024/02/05/DB03-SQL/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,32 @@ <h2 id="user-defined-types">User Defined Types</h2>
<p>Domain 我的理解就是 duck typing,更裤了</p>
<h2 id="others-1">Others</h2>
<p>还有很多很多细碎的</p>
<h1 id="pldb">PL+DB</h1>
<p>一句话:在通用编程语言(PL)里访问和操作数据库(DB)</p>
<p>按照我的理解粗暴分成两类</p>
<ul>
<li>static/compiled/<code>PreparedStatement</code>:传给 DBMS
的查询是某种解析/优化过后的 IR</li>
<li>dynamic/interpretive/<code>Statement</code>:直接给 DBMS 传 SQL
语句</li>
</ul>
<p>这里的 static/dynamic 是相对于 DBMS 而言的,在 host
语言里可能全是动态行为(比如 JDBC
的字符串),也可能是编译期行为(比如大名鼎鼎的 LINQ)</p>
<p>传 IR 的好处显而易见:</p>
<ul>
<li>可以做优化</li>
<li>可以做安全性检查</li>
</ul>
<p><img src="DB03-SQL/eSQL.png" alt="eSQL" style="zoom:100%;" /></p>
<p>对着这张图看</p>
<ul>
<li>最左是 LINQ 那种编译期可以做 lint 检查的 embedded SQL 做法</li>
<li>中间是 JDBC 那种运行期间拼接字符串产生 SQL 查询,调用 API
的做法</li>
<li>最右的两个箭头展示了 static 和 dynamic 的区别(以 JDBC 为例,就是
<code>PreparedStatement</code><code>Statement</code> 的区别)</li>
</ul>

</div>

Expand Down Expand Up @@ -281,7 +307,7 @@ <h2 id="others-1">Others</h2>
<div class="title">目录</div>
<div class="catalog-content">

<ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#basics"><span class="toc-text">Basics</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#others"><span class="toc-text">Others</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#view"><span class="toc-text">View</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#transaction"><span class="toc-text">Transaction</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#constraints"><span class="toc-text">Constraints</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#foreign-key"><span class="toc-text">Foreign key</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#cyclic-reference"><span class="toc-text">Cyclic reference</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#user-defined-types"><span class="toc-text">User Defined Types</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#others-1"><span class="toc-text">Others</span></a></li></ol></li></ol>
<ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#basics"><span class="toc-text">Basics</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#others"><span class="toc-text">Others</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#view"><span class="toc-text">View</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#transaction"><span class="toc-text">Transaction</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#constraints"><span class="toc-text">Constraints</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#foreign-key"><span class="toc-text">Foreign key</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#cyclic-reference"><span class="toc-text">Cyclic reference</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#user-defined-types"><span class="toc-text">User Defined Types</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#others-1"><span class="toc-text">Others</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#pldb"><span class="toc-text">PL+DB</span></a></li></ol>

</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions atom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<link href="http://example.com/atom.xml" rel="self"/>

<link href="http://example.com/"/>
<updated>2024-02-27T06:18:17.076Z</updated>
<updated>2024-02-28T02:22:49.501Z</updated>
<id>http://example.com/</id>

<author>
Expand All @@ -21,7 +21,7 @@
<link href="http://example.com/2024/02/05/DB03-SQL/"/>
<id>http://example.com/2024/02/05/DB03-SQL/</id>
<published>2024-02-05T15:44:12.000Z</published>
<updated>2024-02-27T06:18:17.076Z</updated>
<updated>2024-02-28T02:22:49.501Z</updated>



Expand Down

0 comments on commit 1839ae5

Please sign in to comment.