Choose your database:
AnySQL
MySQL
MS SQL Server
PostgreSQL
SQLite
Firebird
Oracle
SQL Anywhere
DB2
MaxDB

Subscribe to our news:
Partners
Testimonials
Grey: "We're a two-person company, it's just me an my wife. I'm the technical guru, and she handles the business operations. I have to know a lot about MySQL, but that's much too technical for her. I have frequently had to setup CGI scripts (I code in Perl) so she can manage some of our tables (suppliers, manufacturers, etc).

I discovered PHP Generator a couple of days ago, tried the free version,and within a few hours I had purchased the Pro version (as well as SQL Maestro for MySQL).

Today I am completing the conversion of the last of my custom table managers to PHP Generator. This is eliminating several thousand lines of code that I don't have to support any more!

Thanks for this fantastic product".

Gabriela Arsene: "MySQL PHP Generator is really excellent! A very useful, easy to use tool and above all it is free, saving a lot of time and money to a developer! Great job! Congratulations to all the people who work at this project".

More

Add your opinion

PHP Generator for MySQL online Help

Prev Return to chapter overview Next

Data Partitioning

The Data Partitioning wizard allows you to create a custom pagination i.e. split the records on the generated page by a specified criteria. Live demos.

 

Partitioning types

Supported partitioning types are as follows:

 

Range partitioning

Selects a partition by determining if the partitioning expression value is inside a certain range. Live demo.

 

List partitioning

A partition is assigned a list of values. If the partitioning expression value has one of these values, the partition is chosen. For example, all rows where the column 'Country' is either Iceland, Norway, Sweden, Finland or Denmark could build a partition for the 'Nordic countries'. Live demo.

 

Custom partitioning

Create your own partitioning with fill partitions and build conditions functions. Live demo.

 

To disable data partitioning, select None in the drop-down list, then press OK.

 

Partition navigator options

 

Navigator caption

Defines the caption of the label to be displayed

 

 

Navigation style

Defines whether the partition navigator is displayed as a list of hyperlinks or as a combobox.

 

Allow to view record from all partitions

Enable/disable this option to allow/deny viewing data from all partitions.

 

Example 1 (Range partitioning)

There is a table storing information about films such as title, release year, and length.

See definition here

 

CREATE TABLE film (

  film_id               integer NOT NULL,

  title                 varchar(255) NOT NULL,

  release_year          integer,

  length                integer UNSIGNED,

  /* Keys */

  PRIMARY KEY (film_id)

);

 

 

To create a pagination by the film length, select Range partitioning at the first wizard step, choose 'length' as partition expression and set the partitioning ranges as follows:

 

 

Here you can see the result PHP script:

 

 

Example 2 (Custom partitioning)

Assume that a table 'customer' contains the 'last_name' column. Our goal is to group customers by the first letter of their last name as displayed below.

 

To get around such a situation, select Custom partitioning and define functions as follows:

 

function GetPartitions($partitions)

{

  $tmp = array();

  $this->GetConnection()->ExecQueryToArray("

    SELECT DISTINCT

      left(c.last_name, 1) as first_letter 

    FROM customer c

    ORDER BY first_letter", $tmp

  );

  foreach($tmp as $letter) {

    $partitions[$letter['first_letter']] = $letter['first_letter']; 

  }

}

 

function GetPartitionCondition($partitionKey, &$condition)

{

  $condition = "left(last_name, 1) = '$partitionKey'";

}



Prev Return to chapter overview Next