]> git.nbdom.net Git - nb.git/commitdiff
lib/postgres/php_function.sql
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 5 Jun 2023 11:01:12 +0000 (13:01 +0200)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 5 Jun 2023 11:01:12 +0000 (13:01 +0200)
lib/postgres/php_function.sh [new file with mode: 0755]
lib/postgres/php_function.sql [new file with mode: 0644]
lib/postgres/w3schools.sh

diff --git a/lib/postgres/php_function.sh b/lib/postgres/php_function.sh
new file mode 100755 (executable)
index 0000000..16a8c63
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/bash
+cd "$(dirname "$0")" || exit 1;
+IFS=$'\n'
+for i in \
+       array \
+       "calendar '' 1"\
+       "date '' 2"\
+       directory \
+       "error '' 2"\
+       exception \
+       "filesystem '' 2"\
+       "filter '' 2"\
+       "ftp '' 1"\
+       "json '' 1"\
+       keywords \
+       "libxml '' 1"\
+       "mail '' 2"\
+       "math '' 1"\
+       "misc '' 2"\
+       mysqli \
+       network \
+       "output '' 2"\
+       "regex '' 2"\
+       simplexml \
+       stream \
+       string \
+       variable_handling \
+       "xml '' 1"\
+       zip \
+; do
+
+       opt=${i#*" "}
+       [ "$opt" == "$i" ] && opt=""
+       i=${i%%" "*}
+       [ -n "$1" -a "$i" != "$1" ] && continue
+
+       echo "- $i $opt" 1>&2
+       eval ./w3schools.sh /php/php_ref_${i}.asp $opt | sed "s/^/$i\t/"
+done
+#./w3schools.sh /php/php_ref_timezones.asp | sed 's/^/timezones\t/'
diff --git a/lib/postgres/php_function.sql b/lib/postgres/php_function.sql
new file mode 100644 (file)
index 0000000..7c49f47
--- /dev/null
@@ -0,0 +1,9 @@
+DROP TABLE IF EXISTS php_function;
+CREATE TABLE IF NOT EXISTS php_function (
+  cat varchar(30),
+  name varchar(100),
+  description varchar(500),
+  link varchar(200),
+  PRIMARY KEY(cat,name)
+);
+-- COPY php_function FROM '/home/nico/tmp/csv' WITH (format 'text', NULL '');
index 6047c2054130ffd2df526d5f3295f98de05b196a..b935823e2e1807390696f65c9552de5bb1928853 100755 (executable)
@@ -2,14 +2,17 @@
 
 path=${1:?Usage: $0 /path/ for url https://www.w3schools.com}
 cut="$2"
+num="$3"
+
 url="https://www.w3schools.com$path"
 preff="$(echo "$url"|sed -E 's,[^/]+\.[^/]+$,,')"
 #exec echo $preff
+#exec echo "<$cut>"
 
 http_get "$url" | \
 xmllint --format --html --xpath '/html/body//div[@id="main"]//table' - 2>/dev/null | \
 grep -Ev '<th' | \
-html2csv --href2txt | \
+html2csv $(test -z "$num" || echo "--num $num ")--href2txt | \
 sed -E \
        -e "s,\[href=([^]]+),[href=$preff\1,g" \
        -e "s,(\\\\),\1\1," \