]> git.nbdom.net Git - nb.git/commitdiff
lib/php/db/table.php
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 19 Jun 2018 22:14:10 +0000 (23:14 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 19 Jun 2018 22:14:10 +0000 (23:14 +0100)
lib/php/db/table.php
lib/postgres/css_function.sql [new file with mode: 0644]

index aaa0affbe6a5c7335ce9c087bc7dfd0b62392c58..d3b848ba7a285afae3b70961c409ed8e73b56276 100644 (file)
@@ -993,9 +993,10 @@ Class Table extends nb {
 
                        if ($this->p('orderby') and !$count) $sql .= ' ORDER BY '.$this->p('orderby');
 
-                       if ($limit = $this->db()->limit) {
-                               $limit = str_replace(',',' OFFSET ',$limit);
-                               $sql .= ' LIMIT '.$limit;
+                       if ($_limit = $limit = $this->db()->limit) {
+                               $_limit = str_replace(' OFFSET ',',',$_limit);
+                               $_limit = str_replace(',',' OFFSET ',$_limit);
+                               $sql .= ' LIMIT '.$_limit;
                        } else {
                                $limit = '';
                        }
diff --git a/lib/postgres/css_function.sql b/lib/postgres/css_function.sql
new file mode 100644 (file)
index 0000000..8304e63
--- /dev/null
@@ -0,0 +1,17 @@
+DROP TABLE IF EXISTS css_function;
+CREATE TABLE IF NOT EXISTS css_function (
+  name varchar(100) PRIMARY KEY,
+  description varchar(500),
+  link varchar(300)
+);
+BEGIN TRANSACTION;
+DELETE FROM css_function;
+COPY css_function (link,name,description) FROM PROGRAM '. /etc/profile && \
+http_get https://www.w3schools.com/cssref/css_functions.asp | \
+xmllint --html --xpath "/html/body//div[@id=\"main\"]//table" - 2>/dev/null | \
+sed -E "s, href=\"([^\"]+)\",>https://www.w3schools.com/cssref/\1|</a><a,g" | \
+xml2csv - | \
+grep "|" | \
+sed "s/|/\t/" \
+' WITH (format 'text', NULL ''); 
+COMMIT;