Brian "Krow" Aker (krow) wrote,
Brian "Krow" Aker

Protos, Tables, More Fun

Here is an example of using protobuf on table definitions for Drizzle:

[brian@piggy serialize]$ ./table_reader example_table.frm
CREATE TABLE `example_table` (
	`sample0` VARCHAR(83),
	`sample1` VARCHAR(86) CHARACTER SET utf8 COLLATE utf8_swedish_ci NOT NULL ,
	`sample2` VARCHAR(77) CHARACTER SET utf8 COLLATE utf8_swedish_ci,
	`number` INTEGER ,
	`colors` ENUM('red','blue','green') ,
	`some_btye_string` BLOB ,
	`important_number` DECIMAL(8,3) ,
	`important_string` VARCHAR(20),
	 PRIMARY KEY (`number`),
	 UNIQUE KEY `sample0` (`sample0`),
	 UNIQUE KEY `sample1` (`sample1`)
  ENGINE = Innodb;

[brian@piggy serialize]$ du example_table.frm
4	example_table.frm

The size is very reasonable, and descriptive code is much, much smaller then before.

What else is sharp? Extending the definition for new objects is now cake.

Bye, Bye crummy if/else/version/garbage.
  • Post a new comment


    Comments allowed for friends only

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 1 comment