Tag Archives: PHP

MyISAM Storage Engine

MyISAM is the default storage engine. It is based on the older ISAM storage engine with new extensions.
It manages nontransactional tables. It provides high-speed storage and retrieval, as well as fulltext searching capabilities
Each MyISAM table is stored on disk in three files. The files have names that begin with the table name and have an extension to indicate the file type. An .frm file stores the table format.
The data file has an .MYD (MYData) extension. The index file has an .MYI (MYIndex) extension.

Storage engine should be mentioned when we careate tables

CREATE TABLE table (no INT) ENGINE = MYISAM;

Normally, it is unnecessary to use ENGINE to specify the MyISAM storage engine. MyISAM is the default engine unless the default has been changed. To ensure that MyISAM is used in situations where the default might have been changed, include the ENGINE option explicitly.

You can check or repair MyISAM tables with the mysqlcheck client or myisamchk utility.

All data values are stored with the low byte first. This makes the data machine and operating system independent.

All numeric key values are stored with the high byte first to permit better index compression.

Large files (up to 63-bit file length) are supported on file systems and operating systems that support large files.

There is a limit of 232  rows in a MyISAM table. If you build MySQL with the

The maximum number of indexes per MyISAM table is 64.

The maximum number of columns per index is 16.

The maximum key length is 1000 bytes.

When rows are inserted in sorted order ,the index tree is split so that the high node only contains one key. This improves space utilization in the index tree.

MyISAM supports concurrent inserts:

You can put the data file and index file in different directories on different physical devices

BLOB and TEXT columns can be indexed.

NULL values are permitted in indexed columns.

There is a flag in the MyISAM index file that indicates whether the table was closed correctly.

The sum of the lengths of the VARCHAR and CHAR columns in a table may be up to 64KB.

 

Storage Engines

A storage engine (database engine) is the underlying software component that a database management system (DBMS) uses to create, read, update and delete (CRUD) data from a database. Many of the modern DBMS support multiple database engines within the same database.Below given are the different storage engines that MySQL supports .

Create widget – Socialengine

I am currently trying to learn the open source social engine  and would like to share  my finding with youall . Here I will explain how we can develop a widget that will display a text on a page .

1) Create a folder with a meaningful name in “application/widgets”. here I use “phpcodez”  .
Type the following commands from socialengine installation directory

cd  application

mkdir   phpcodez

2)  Then create 3 files “Controller.php” ,”index.tpl” and ”manifest.php” in the new folder “phpcodez”

gedit Controller.php
gedit index.tpl
gedit manifest.php

As you know the socialengine follows MVC structure . So controller lies in “Controller.php”
and view lies in “index.tpl” . The file “manifest.php“ ,will tell the system that a new widget has been added .

3) Paste the below given code in “Controller.php”

<?php
class Widget_phpcodezController extends Engine_Content_Widget_Abstract {
public function indexAction()  {
$this->view->title=’PHPCodez’;
}
}

?>

The “indexAction()” function will be invoked when the widget called .

So we must prepare the data to be passed to the view . Here variable are  declared and initialized as follows

$this->view->VARIABLE_NAME .

4) Paste the below given code in “index.tpl”

<?php
echo $this->title;
?>

We can print the values of the variable as shown above .

5) Paste the below given code in “manifest.php”

<?php

return array(
‘package’ => array(
‘type’ => ‘widget’,
‘name’ => ‘phpcodez’,
‘version’ => ‘4.0.0’,
‘revision’ => ‘$Revision: 8822 $’,
‘path’ => ‘application/widgets/phpcodez’,
‘repository’ => ‘socialengine.net’,
‘title’ => ‘PHPCodez’,
‘description’ => ‘Displays a “powered by PHPCodez” link.’,
‘author’ => ‘Webligo Developments’,
‘directories’ => array(
‘application/widgets/phpcodez’,
),
),

// Backwards compatibility
‘type’ => ‘widget’,
‘name’ => ‘phpcodez’,
‘version’ => ‘4.0.0’,
‘revision’ => ‘$PHPCodez: 8822 $’,
‘title’ => ‘phpcodez’,
‘description’ => ‘Displays a “powered by PHPCodez” link.’,
‘author’ => ‘Webligo Developments’,
‘category’ => ‘Widgets’,
)

?>

It tells the system that a new widget has been added .

NOTE : If any database operation is required , create a model and let the controller interact with it .

php_uname

It returns information about the operating system PHP is running on

Example

<?php
echo php_uname();
?>

Ouput

Linux phpcodez-System-Product-Name 2.6.35-22-generic #35-Ubuntu SMP Sat Oct 16 20:36:48 UTC 2010 i686