← Back to team overview

maria-discuss team mailing list archive

new kind of plugin

 

Hi guys,
I was thinking about a new kind of plugin, a field type plugin... i think
it's a relative interesting idea...
about sintax:

ALTER TABLE table
ADD field PLUGIN("plugin_name","version","field_type","parameters") NOT
NULL/NULL DEFAULT 'something' AUTOINCREMENT, etc..

an example...

ALTER TABLE table
ADD field PLUGIN("crypt","1","somecrypto","size=255") NOT NULL DEFAULT
'something'

internally (to storage engine) this kind of data will be saved as blob (for
example), and to client side it will be a blob too

when i use:
insert into table(field) values ("some text");
and
select * from table

i will get "some text"
but internally (at filesystem) the value is save as a crypto of "some text"
---
other idea is compress

ADD field PLUGIN("crypt","1","compress","size=255") NOT NULL DEFAULT
'something'

internally it will be saved as varchar(255), when i execute insert it will
compress the value and when i select it will uncompress the value

the parameters for this new field type is:
PLUGIN(plugin name, plugin version, plugin field name, parameters)

plugin name is the plugin name...
plugin version is important to execute alter table, or when using diferent
kind of plugin versions we could know what version is being used and
execute a automatic alter table for example...
plugin field is the type of field in this plugin
parameters are parameters for plugin values

another idea is a enum with external table...
ADD field
PLUGIN("external_enum",'1','enum','table=database.table,id=field_id,value=field_value')

it will execute a SELECT internally to table "database.table" and return
the id/value of that table
id is a bigint/int/mediumint/smallint/tinyint value (like enum index)
and value is a string value (varchar,char,longtext,text)

to storage engine will be used a bigint, for user it will be used as a
enum() field

------
thre's more examples with interesting things, like expand opengis, or add
others kind of field types, but the main idea is create a plugin interface
for field types

what you say guys?

bye =)
-- 
Roberto Spadim

Follow ups