~sivers/sive.rs

ref: b2f50afe9f3a46f2848387525ab5fefcaad1de58 sive.rs/site/pg2 -rw-r--r-- 2.5 KiB
b2f50afe — Derek Sivers ArtistData is gone 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>PostgreSQL example of self-contained stored procedures | Derek Sivers</title>
<meta name="description" content="First, see my previous article about PostgreSQL functions at sive.rs/pg. That article gave tiny examples, but no finished working code.">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="/style.css">
<link rel="alternate" type="application/atom+xml" title="Derek Sivers" href="/en.atom">
<link rel="alternate" type="application/rss+xml" title="Derek Sivers podcast" href="/podcast.rss">
<link rel="prev" href="https://sive.rs/masch">
<link rel="next" href="https://sive.rs/trav1">
</head>
<body id="article">
<section id="masthead">
<h1><a href="/" title="Derek Sivers">Derek Sivers</a></h1>
</section>
<div id="content">

<article>
<header>
<div class="blogparent"><a href="/blog">Articles</a>:</div>
<h1>PostgreSQL example of self-contained stored procedures</h1>
<small>2019-10-25</small>
  <audio src="https://m.sive.rs/sive.rs.pg2.mp3" preload="none" controls="controls"></audio>
</header>

<p>
First, see <a href="/pg">my previous article about PostgreSQL functions</a> at <a href="/pg">sive.rs/pg</a>.
That article gave tiny examples, but no finished working code.
</p><p>
This week, I wrote a shopping cart to sell my books directly from my own site.
</p><p>
So I took a couple extra hours today to put my code into public view, so anyone can play around with it.
See <a href="https://github.com/sivers/store">github.com/sivers/store</a>, to browse, download, and try it.
</p><p>
It’s a working self-contained shopping cart / store.
It’s a very concrete example of <strong>using stored procedures to keep all the data logic together</strong> in one place.
You can use it from JavaScript, Python, Ruby, or any language you want, since all the functionality is in the database itself.
It works.
</p><p>
If you have any questions, or want to tell me how <a href="/publicu">stupid</a> I am for doing this, <a href="/contact">email me</a>.
</p>
<img src="/images/postgresql.png" alt="postgresql logo">

<footer>
© 2019 <a href="https://sive.rs/">Derek Sivers</a>.
(
  « <a href="/masch" accesskey="p" rel="prev">previous</a>
    ||
  <a href="/trav1" accesskey="n" rel="next">next</a> »
)
<h1>
  Copy &amp; share:
  <span class="url"><a href="https://sive.rs/pg2">sive.rs/pg2</a></span>
</h1>
</footer>
</article>
<div id="comments"></div>
<script type="text/javascript" src="/js/comments.js"></script>

</div>
</body>
</html>