Search This Blog

Thursday, February 25, 2010

MySQL Storage Engine Comparision

 MyISAM Storage Engine Features(default storage engine)
Storage limits
256TB
Transactions
No
Locking granularity
Table
MVCC
No
Geospatial datatype support
Yes
Geospatial indexing support
Yes
B-tree indexes
Yes
Hash indexes
No
Full-text search indexes
Yes
Clustered indexes
No
Data caches
No
Index caches
Yes
Compressed data
Yes[a]
Encrypted data[b]
Yes
Cluster database support
No
Replication support[c]
Yes
Foreign key support
No
Backup / point-in-time recovery[d]
Yes
Query cache support
Yes
Update statistics for data dictionary
Yes



InnoDB Storage Engine Features
Storage limits
64TB
Transactions
Yes
Locking granularity
Row
MVCC
Yes
Geospatial datatype support
Yes
Geospatial indexing support
No
B-tree indexes
Yes
Hash indexes
No
Full-text search indexes
No
Clustered indexes
Yes
Data caches
Yes
Index caches
Yes
Compressed data
Yes[a]
Encrypted data[b]
Yes
Cluster database support
No
Replication support[c]
Yes
Foreign key support
Yes
Backup / point-in-time recovery[d]
Yes
Query cache support
Yes
Update statistics for data dictionary
Yes




 MEMORY Storage Engine Features
The MEMORY storage engine creates tables with contents that are stored in memory. Formerly, these were known as HEAP tables. MEMORY is the preferred term, although HEAP remains supported for backward compatibility.
Storage limits
RAM
Transactions
No
Locking granularity
Table
MVCC
No
Geospatial datatype support
No
Geospatial indexing support
No
B-tree indexes
Yes
Hash indexes
Yes
Full-text search indexes
No
Clustered indexes
No
Data caches
N/A
Index caches
N/A
Compressed data
No
Encrypted data[a]
Yes
Cluster database support
No
Replication support[b]
Yes
Foreign key support
No
Backup / point-in-time recovery[c]
Yes
Query cache support
Yes
Update statistics for data dictionary
Yes



ARCHIVE Storage Engine Features
The ARCHIVE storage engine is used for storing large amounts of data without indexes in a very small footprint.
Storage limits
None
Transactions
No
Locking granularity
Row
MVCC
No
Geospatial datatype support
Yes
Geospatial indexing support
No
B-tree indexes
No
Hash indexes
No
Full-text search indexes
No
Clustered indexes
No
Data caches
No
Index caches
No
Compressed data
Yes
Encrypted data[a]
Yes
Cluster database support
No
Replication support[b]
Yes
Foreign key support
No
Backup / point-in-time recovery[c]
Yes
Query cache support
Yes
Update statistics for data dictionary
Yes



Others

The BLACKHOLE storage engine acts as a “black hole” that accepts data but throws it away and does not store it. 

The CSV storage engine stores data in text files using comma-separated values format.

The FEDERATED storage engine enables data to be accessed from a remote MySQL database on a local server without using replication or cluster technology. When using a FEDERATED table, queries on the local server are automatically executed on the remote (federated) tables. No data is stored on the local tables.

The EXAMPLE storage engine is a stub engine that does nothing. Its purpose is to serve as an example in the MySQL source code that illustrates how to begin writing new storage engines. As such, it is primarily of interest to developers.

The MERGE storage engine, also known as the MRG_MyISAM engine, is a collection of identical MyISAM tables that can be used as one. “Identical” means that all tables have identical column and index information. You cannot merge MyISAM tables in which the columns are listed in a different order, do not have exactly the same columns, or have the indexes in different order.

The IBMDB2I storage engine is designed as a fully featured transaction-capable storage engine that enables MySQL to store its data in DB2 tables running on IBM i. With the IBMDB2I storage engine, data can be shared between MySQL applications and applications coded for native DB2 for i interfaces.

20 new features in PHP5

1. public/private/protected access modifiers for methods and properties before it was using var
2. Unified constructor name __construct() and destructor __destruct() (__[function name ] are mentioned as magic function user should not declare or define a function with __ if they really know the meaning and there is a real need for that )
3. Interfaces  -- this is like class which can have any no of functions and variable but we can only declare not define here and all these thing should be public , All the methods on the interface should be defined on the child class else it will show an fata (Now Multiple inhertance is possible with this )
5. instanceof operator -- before it was is_a() which will check wheather a function is a of an particular object like that
6. final methods -- stops overloading functions
7. final class -- stops class inhertance
8. Explicit object cloning -- we can define __clone method to be called automatically after cloning an object
9. Class constants -- we can have constants inside a class and use object of that class to refer that constant

10.Static methods -- these methods can be called without object using class name like class1::method1 where method 1 is a static method on class1
eg: class1::method1
11. Static members : Classes definitions can now include static members (properties), accessible via the class. Common usage of static members is in the Singleton pattern.

12. abstract classes
A class may be declared as abstract so as to prevent it from being instantiated. However, you may inherit from an abstract class
13. abstract methods
A method may be declared as abstract, thereby deferring its definition to an inheriting class. A class that includes abstract methods must be declared as abstract.
14. Class type hints
Function declarations may include class type hints for their parameters. If the functions are called with an incorrect class type an error occurs.
eg:
class class1(classname obj)
{
...
}
15. Support for dereferencing objects which are returned from methods.
In PHP 4, you could not directly dereference objects which are returned from methods. You would have to first assign the object to a dummy variable and then dereference it.
eg :
PHP4
$dummy = $obj->method(); //this method returns an object which is assigned to new variable then calling the menthod of the returned object on the second statement
$dummy->method2();
PHP5
$obj->method()->method2(); // now we can call directly

16. Iterators
PHP 5 allows both PHP classes and PHP extension classes to implement an Iterator interface. Once you implement this interface you will be able to iterate instances of the class by using the foreach() language construct.

17. __autoload() -- include the file inc or php when it is required using the class name
eg:
function __autoload()
{
include_once ($class_name.".php");
}

18. Exception handling : try/throw/catch

19. foreach with references
eg: foreach ($var as &$key=>$value){...}
20. default values for by-reference parameters
eg: function method1(&$arg1=10){...}

Wednesday, February 24, 2010

Install Cake PHP

tar -xvjf cake_1.3-dev.tar.bz2

mv cake_1.3-dev caketest

chmod -R 777 app/tmp

enable mod rewrite module on apache
in ubuntu sudo a2enmod rewrite
restart your web server

open app/config/core.php change the security salt new (md5 preferrable) value

save app/config/database.php.default as app/config/database.php change the following values for default variable
'driver' => 'mysql',//can be mysql,postgresql etc., we are going to use mysql
'persistent' => false,//will be use full if database server is on different machine
'host' => 'localhost', //not necessary  if you have your db on the same machine
'login' => 'sundar',
'password' => '*******************',
'database' => 'caketest',
'prefix' => '', // not necessary

give a link on your web server to point this folder

if every thing goes fine you will be seeing a webpage like this

Tuesday, February 16, 2010

How to structure your repository in SVN

I read a article on subversion architecture just thought of sharing with you (http://ariejan.net/2006/11/24/svn-how-to-structure-your-repository/), I have tailored this article to be easy to learn if you want the full article please check out the link given above


Subversion repository are three directories: branches, tags and trunk.
Each directory in subversion can be checked out separately.
Trunk

The trunk contains the most current development code at all times. This is where you work up to your next major release of code.
The trunk should only be used to develop code that will be your next major release. Don’t brand the trunk with version numbers or release names. Just keep the trunk in “development mode” at all times.
Example:
https://svn.example.com/svnroot/project/trunk

Branches

There are different types of branches.
With the branches directory you can create paths for you code to travel to more specific goals like an upcoming release.Subversion the branches directory contains copies of your trunk at various stages of development.

Release Branches

We have already seen the RB-x.x release branches. When the trunk reaches the stage that it’s ready to be released (or when you want to freeze the addition of new features) you create a release branch.

This release branch is just a copy of your current trunk code.

https://svn.example.com/svnroot/project/branches/RB-1.0

Bug fix branches

Branches may also be used to address the more serious bugs found in the trunk or a release branch. The bugs are of such a magnitute that you can’t fix them by yourself in a single commit. So, in order to focus on the problem of fixing this bug you should create a new branch for this purpose. This allows development in the trunk or your release branch to continue, and you won’t disturb them with new bugs or tests that break the current code.

Bug fix branches are named after the ID they are assigned in your bugtracking tool. Mostly this is a number: BUG-3391

https://svn.example.com/svnroot/project/branches/BUG-3391


Experimental branches

Something that also happens a lot is the introduction of new technologies. This is fine, of course, but you don’t want to bet your entire project on it.
Imagine that you want to change from PHP 4 to PHP 5 for your web application. How long would it take you to convert your entire project? Do you want your entire code base (trunk) to be useless until you have converted all of your code? Probably not!

Experimental branches may be abandonned when the experiment fails. If they succeed you can easily merge that branch with the trunk and deliver your big new technology. These branches are named after what you’re experimenting with.

https://svn.example.com/svnroot/project/branches/TRY-new-technology

Tags

Tags are, like branches, copies of your code. Tags, however, are not to be used for active development. They mark (tag) a certain state your code is in.

Release tags

Release tags mark the release (and state) of your code at that release point. Release tags are always copies of the corresponding release branch. Release tags are prefixed with ‘REL-’ followed by a version number.


https://svn.example.com/svnroot/project/tags/REL-1.0.0

Tuesday, February 9, 2010

Make Database Template in postgresql using php

Views

SELECT table_name,view_definition from information_schema.views where table_catalog='$db_name' and table_schema='$schema_name'  order by 1;

Tables 
SELECT table_name From information_schema.tables where table_type='BASE TABLE'  and table_catalog='$db_name' and table_schema='$schema_name'  order by 1;

Columns in a Table with properties

SELECT column_name,data_type,is_nullable from information_schema.columns where table_catalog='$db_name' and table_schema='$schema_name' and table_name='$table_name';


Functions 
SELECT routine_name,routine_definition from information_schema.routines where routine_schema='$schema_name' and routine_catalog='$db_name' order by 1;