Ferreteria/v0.42/sql/node leaf: Difference between revisions

From Woozle Writes Code
Jump to navigation Jump to search
m (Woozle moved page Ferreteria/v0.42/sql/leaf to Ferreteria/v0.42/sql/node leaf without leaving a redirect: where it's supposed to be (same as the table name))
m (6 revisions imported: moving this project here)
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
'''versions''': {{l/ferreteria/|v0.41/sql/node_leaf|0.41}}, {{l/ferreteria/|v0.42/sql/node_leaf|0.42}}, {{l/ferreteria/|v0.5/sql/node_leaf|0.5}}
==About==
==About==
* '''Purpose''': Values for nodes
* '''Purpose''': Values for nodes
Line 14: Line 15:
* '''2020-01-16''' redesigning for v0.4 (copied from [[Ferreteria/sql/tf leaf]]) - this became 0.41
* '''2020-01-16''' redesigning for v0.4 (copied from [[Ferreteria/sql/tf leaf]]) - this became 0.41
* '''2020-01-23''' tweaking for v0.42
* '''2020-01-23''' tweaking for v0.42
* '''2021-01-19'''
** "integer width is deprecated"; also decided it should be 8 bytes
** Turns out LONGTEXT [https://stackoverflow.com/questions/10957238/incorrect-string-value-when-trying-to-insert-utf-8-into-mysql-via-jdbc barfs at certain kinds of binary data], so changing to LONGBLOB.
==SQL==
==SQL==
<source lang=mysql>CREATE TABLE `node_leaf` (
<syntaxhighlight lang=mysql>CREATE TABLE `node_leaf` (
   `ID`      INT(4)       NOT NULL AUTO_INCREMENT,
   `ID`      BIGINT       NOT NULL AUTO_INCREMENT,
   `ID_Node` INT(4)       NOT NULL COMMENT "ID of node to which this value belongs",
   `ID_Node` BIGINT       NOT NULL COMMENT "ID of node to which this value belongs",
   `Name`    VARCHAR(255)  NOT NULL COMMENT "field name of this value",
   `Name`    VARCHAR(255)  NOT NULL COMMENT "field name of this value",
   `Value`  LONGTEXT DEFAULT NULL COMMENT "value, in string format",
   `Value`  LONGBLOB DEFAULT NULL COMMENT "value",
   PRIMARY KEY(`ID`),
   PRIMARY KEY(`ID`),
   UNIQUE KEY(`ID_Node`,`Name`)
   UNIQUE KEY(`ID_Node`,`Name`)
) ENGINE=InnoDB;</source>
) ENGINE=InnoDB;</syntaxhighlight>

Latest revision as of 16:44, 22 May 2022

versions: 0.41, 0.42, 0.5

About

  • Purpose: Values for nodes

Concept

Every leaf:

  • has
    • a data type
    • a name (unique within the node)
    • a value
  • is like a single field in a single record

Fields

  • Type: name of type; caller code will maintain an index of leaf-handler classes (array[Type] => class_name)

History

  • 2017-08-03 Started, because the need became apparent.
  • 2020-01-16 redesigning for v0.4 (copied from Ferreteria/sql/tf leaf) - this became 0.41
  • 2020-01-23 tweaking for v0.42
  • 2021-01-19

SQL

CREATE TABLE `node_leaf` (
  `ID`      BIGINT        NOT NULL AUTO_INCREMENT,
  `ID_Node` BIGINT        NOT NULL COMMENT "ID of node to which this value belongs",
  `Name`    VARCHAR(255)  NOT NULL COMMENT "field name of this value",
  `Value`   LONGBLOB  DEFAULT NULL COMMENT "value",
  PRIMARY KEY(`ID`),
  UNIQUE KEY(`ID_Node`,`Name`)
) ENGINE=InnoDB;