aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/out_cgi_search_sqlite.org
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2020-10-16 19:16:18 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2020-10-19 13:26:15 -0400
commit0c693b23c4ff8f98a151884a24f150a5ff746dd4 (patch)
treef638d7942cab5b20adc3761ad7fcb62283eeefd8 /org/out_cgi_search_sqlite.org
parentcgi.d arsd update (diff)
org mode, unique code-block names & adjust headers
- avoid org-mode undefined behavior, provide unique code-block names
Diffstat (limited to 'org/out_cgi_search_sqlite.org')
-rw-r--r--org/out_cgi_search_sqlite.org53
1 files changed, 33 insertions, 20 deletions
diff --git a/org/out_cgi_search_sqlite.org b/org/out_cgi_search_sqlite.org
index f9b90d0..df98ed9 100644
--- a/org/out_cgi_search_sqlite.org
+++ b/org/out_cgi_search_sqlite.org
@@ -7,6 +7,7 @@
#+COPYRIGHT: Copyright (C) 2015 - 2020 Ralph Amissah
#+LANGUAGE: en
#+STARTUP: content hideblocks hidestars noindent entitiespretty
+#+OPTIONS: H:3 num:nil toc:t \n:nil @:t ::t |:t ^:nil _:nil -:t f:t *:t <:t
#+PROPERTY: header-args :exports code
#+PROPERTY: header-args+ :noweb yes
#+PROPERTY: header-args+ :eval no
@@ -99,21 +100,33 @@ void cgi_function_intro(Cgi cgi) {
<<cgi_sqlite_initialize_text>>
<<cgi_sqlite_initialize_rgx>>
<<cgi_sqlite_initialize_fields>>
- <<cgi_sqlite_initialize_env>>
+ <<cgi_sqlite_initialize_env_0>>
+ <<cgi_sqlite_initialize_env_1>>
<<cgi_sqlite_initialize_tail>>
<<cgi_sqlite_initialize_sql_select>>
<<cgi_sqlite_initialize_canned_url>>
<<cgi_sqlite_initialize_regex_for_canned_search>>
<<cgi_sqlite_initialize_show_matched_objects>>
<<cgi_sqlite_initialize_previous_next>>
-<<cgi_sqlite_header>>
+<<cgi_sqlite_header_0>>
+<<cgi_sqlite_header_1>>
+<<cgi_sqlite_header_2>>
<<cgi_sqlite_table>>
-<<cgi_sqlite_form>>
+<<cgi_sqlite_form_0>>
+<<cgi_sqlite_form_1>>
+<<cgi_sqlite_form_2>>
+<<cgi_sqlite_form_3>>
"%s",
-<<cgi_sqlite_form_post>>
+<<cgi_sqlite_form_post_0>>
+<<cgi_sqlite_form_post_1>>
<<cgi_sqlite_write>>
<<cgi_sqlite_set_db>>
<<cgi_sqlite_select_statement_0>>
+<<cgi_sqlite_select_statement_1>>
+<<cgi_sqlite_select_statement_2>>
+<<cgi_sqlite_select_statement_3>>
+<<cgi_sqlite_select_statement_4>>
+<<cgi_sqlite_select_statement_5>>
<<cgi_sqlite_db_close>>
<<cgi_sqlite_db_tail>>
}
@@ -409,7 +422,7 @@ auto text_fields() {
***** env
****** POST
-#+NAME: cgi_sqlite_initialize_env
+#+NAME: cgi_sqlite_initialize_env_0
#+BEGIN_SRC d
if (environment.get("REQUEST_METHOD", "POST") == "POST") {
if ("sf" in cgi.post) {
@@ -559,7 +572,7 @@ auto text_fields() {
****** GET
-#+NAME: cgi_sqlite_initialize_env
+#+NAME: cgi_sqlite_initialize_env_1
#+BEGIN_SRC d
} else if (environment.get("REQUEST_METHOD", "POST") == "GET") {
got.canned_query = environment.get("QUERY_STRING", "");
@@ -814,7 +827,7 @@ string show_matched_objects (string fn) {
**** format
-#+NAME: cgi_sqlite_header
+#+NAME: cgi_sqlite_header_0
#+BEGIN_SRC d
{
header = format(q"┃
@@ -822,7 +835,7 @@ string show_matched_objects (string fn) {
**** html
-#+NAME: cgi_sqlite_header
+#+NAME: cgi_sqlite_header_1
#+BEGIN_SRC html
<!DOCTYPE html>
<html>
@@ -839,7 +852,7 @@ string show_matched_objects (string fn) {
**** css
-#+NAME: cgi_sqlite_header
+#+NAME: cgi_sqlite_header_2
#+BEGIN_SRC css
*{
padding : 0px;
@@ -1667,7 +1680,7 @@ string show_matched_objects (string fn) {
*** cgi html form
-#+NAME: cgi_sqlite_form
+#+NAME: cgi_sqlite_form_0
#+BEGIN_SRC d
{
string post_value(string field_name, string type="box", string set="on") {
@@ -1710,7 +1723,7 @@ string show_matched_objects (string fn) {
**** canned search
-#+NAME: cgi_sqlite_form
+#+NAME: cgi_sqlite_form_1
#+BEGIN_SRC d
string the_can(string fv) {
string show_the_can = post_value("url");
@@ -1748,7 +1761,7 @@ string show_matched_objects (string fn) {
**** provide tip
-#+NAME: cgi_sqlite_form
+#+NAME: cgi_sqlite_form_2
#+BEGIN_SRC d
string provide_tip() {
string searched_tip = post_value("se");
@@ -1785,7 +1798,7 @@ string show_matched_objects (string fn) {
**** the form
***** form html
-#+NAME: cgi_sqlite_form
+#+NAME: cgi_sqlite_form_3
#+BEGIN_SRC html
form = format(q"┃
<form action="%%s" id="SubmitForm" method="post" accept-charset="UTF-8">
@@ -1823,7 +1836,7 @@ string show_matched_objects (string fn) {
***** form values
-#+NAME: cgi_sqlite_form_post
+#+NAME: cgi_sqlite_form_post_0
#+BEGIN_SRC d
(post_value("ec") == "checked") ? post_value("sf", "field") : "",
provide_tip,
@@ -1843,7 +1856,7 @@ string show_matched_objects (string fn) {
**** set value (debug)
-#+NAME: cgi_sqlite_form_post
+#+NAME: cgi_sqlite_form_post_1
#+BEGIN_SRC d
{
string set_value(string field_name, string default_val) {
@@ -2008,7 +2021,7 @@ auto db = Database(conf.db_path ~ cv.db_selected);
**** db SELECT statement, the body
-#+NAME: cgi_sqlite_select_statement_0
+#+NAME: cgi_sqlite_select_statement_1
#+BEGIN_SRC sql
sql_select.the_body ~= format(q"┃
SELECT
@@ -2051,7 +2064,7 @@ LIMIT %%s OFFSET %%s
**** html write selected
***** head
-#+NAME: cgi_sqlite_select_statement_0
+#+NAME: cgi_sqlite_select_statement_2
#+BEGIN_SRC d
(cv.checked_sql)
? cgi.write(previous_next
@@ -2100,7 +2113,7 @@ LIMIT %%s OFFSET %%s
***** text found
-#+NAME: cgi_sqlite_select_statement_0
+#+NAME: cgi_sqlite_select_statement_3
#+BEGIN_SRC d
if (cv.results_type == "txt") {
if (row["ocn"].as!string != "0") {
@@ -2143,7 +2156,7 @@ LIMIT %%s OFFSET %%s
***** ocn index
-#+NAME: cgi_sqlite_select_statement_0
+#+NAME: cgi_sqlite_select_statement_4
#+BEGIN_SRC d
} else {
if (row["ocn"].as!string != "0") {
@@ -2176,7 +2189,7 @@ LIMIT %%s OFFSET %%s
***** tail
-#+NAME: cgi_sqlite_select_statement_0
+#+NAME: cgi_sqlite_select_statement_5
#+BEGIN_SRC d
}
cgi.write( previous_next);