Ferreteria/sql/user client: Difference between revisions

From Woozle Writes Code
Jump to navigation Jump to search
m (changing table names to singular)
(CRC is signed)
Line 7: Line 7:
* '''History''':
* '''History''':
** '''2009-06-16''' Changing name to singular
** '''2009-06-16''' Changing name to singular
** '''2009-09-11''' CRC comes out negative sometimes, so making this SIGNED
==SQL==
==SQL==
<section begin=sql /><mysql>DROP TABLE IF EXISTS `shop_client`;
<section begin=sql /><mysql>DROP TABLE IF EXISTS `shop_client`;
CREATE TABLE `shop_client` (
CREATE TABLE `shop_client` (
   `ID`        INT NOT NULL AUTO_INCREMENT,
   `ID`        INT         NOT NULL AUTO_INCREMENT,
   `CRC`        INT UNSIGNED NOT NULL COMMENT "crc32(Address+Browser) - unique integer defined by client specs",
   `CRC`        INT         NOT NULL COMMENT "crc32(Address+Browser) - unique integer defined by client specs",
   `Address`    VARCHAR(15) NOT NULL COMMENT "IP address of client",
   `Address`    VARCHAR(15) NOT NULL COMMENT "IP address of client",
   `Domain`    VARCHAR(255) COMMENT "Domain name of client",
   `Domain`    VARCHAR(255)         COMMENT "Domain name of client",
   `Browser`    VARCHAR(255) COMMENT "Browser USER_AGENT string",
   `Browser`    VARCHAR(255)         COMMENT "Browser USER_AGENT string",
   `WhenFirst`  DATETIME NOT NULL COMMENT "When this client was first seen",
   `WhenFirst`  DATETIME   NOT NULL COMMENT "When this client was first seen",
   `WhenFinal`  DATETIME COMMENT "When this client was most recently seen",
   `WhenFinal`  DATETIME             COMMENT "When this client was most recently seen",
   PRIMARY KEY(`ID`),
   PRIMARY KEY(`ID`),
   UNIQUE KEY(`CRC`)
   UNIQUE KEY(`CRC`)
  ) ENGINE = MYISAM;</mysql>
  ) ENGINE = MYISAM;</mysql>
<section end=sql />
<section end=sql />

Revision as of 16:26, 11 September 2009

About

  • Status: design is under construction
  • Fields
    • CRC: checksum uniquely identifying user's IP address and browser client software. See notes.
  • Notes:
    • For identifying the user, decided to use CRC32 instead of compression because the compressed strings always came out at least as long as the original string. They were probably designed to be effective for rather longer data.
  • History:
    • 2009-06-16 Changing name to singular
    • 2009-09-11 CRC comes out negative sometimes, so making this SIGNED

SQL

<section begin=sql /><mysql>DROP TABLE IF EXISTS `shop_client`; CREATE TABLE `shop_client` (

 `ID`         INT         NOT NULL AUTO_INCREMENT,
 `CRC`        INT         NOT NULL COMMENT "crc32(Address+Browser) - unique integer defined by client specs",
 `Address`    VARCHAR(15) NOT NULL COMMENT "IP address of client",
 `Domain`     VARCHAR(255)         COMMENT "Domain name of client",
 `Browser`    VARCHAR(255)         COMMENT "Browser USER_AGENT string",
 `WhenFirst`  DATETIME    NOT NULL COMMENT "When this client was first seen",
 `WhenFinal`  DATETIME             COMMENT "When this client was most recently seen",
 PRIMARY KEY(`ID`),
 UNIQUE KEY(`CRC`)
) ENGINE = MYISAM;</mysql>

<section end=sql />