Quantcast
Channel: MySQL – The CodeFluent Entities Blog
Viewing all articles
Browse latest Browse all 6

MySQL and MariaDB Storage Engine

$
0
0

MySQL and MariaDB support several storage engines that act as handlers for different table types. They include both those that handle transaction-safe tables and those that handle nontransaction-safe tables.

You can see supported engine by running the SQL command “SHOW ENGINES” of your favorite MySQL Client tool:

Show Engines

We understand that you may want to use another storage engine. This is why we introduce a new options.

You can define the default storage engine at producer level:

Configuration Storage Engine

By using XML:

<cf:producer name="MySQL" 
             typeName="CodeFluent.Producers.MySQL.MySQLProducer, 
                       CodeFluent.Producers.MySQL">
    <cf:configuration defaultStorageEngine="MyISAM" />
</cf:producer>

Or at entity level:

<cf:entity name="Customer" 
    cfmy:storageEngine="MyISAM" 
    xmlns:cfmy="http://www.softfluent.com/codefluent/producers.mysql/2012/1">
    
    <cf:property name="Id" key="true" />
    <cf:property name="Name" />
</cf:entity>

The generated code will now use the storage engine defined at entity level, or at producer level or InnoDB if nothing is specified:

CREATE TABLE `StorageEngine`.`Customer`
    (
    `Customer_Id` BINARY (16) NOT NULL,
    `Customer_Name` VARCHAR (256) CHARACTER SET utf8 NULL,
    `_trackLastWriteTime` DATETIME NOT NULL,
    `_trackCreationTime` DATETIME NOT NULL,
    `_trackLastWriteUser` VARCHAR (64) NOT NULL,
    `_trackCreationUser` VARCHAR (64) NOT NULL,
    `_rowVersion` BINARY (16) NOT NULL,
    CONSTRAINT `PK_Cus_Cus_Cus` PRIMARY KEY
    (
        `Customer_Id`
    )
) ENGINE = MyISAM;

Happy storing,

R&D Team



Viewing all articles
Browse latest Browse all 6

Trending Articles