Commit 53eabd3d authored by meus's avatar meus

Fixed windows newlines ^M and removed <br /> tags. They should not be used in

the docs. 
parent 16e42966
<p>
Compiling is a method for making a single file of most used doctrine runtime components
including the compiled file instead of multiple files (in worst cases dozens of files)
can improve performance by an order of magnitude.
</p>
<p>
In cases where this might fail, a Doctrine_Exception is throw detailing the error.
</p>
Compiling is a method for making a single file of most used doctrine runtime components including the compiled file instead of multiple files (in worst cases dozens of files) can improve performance by an order of magnitude. In cases where this might fail, a Doctrine_Exception is throw detailing the error.
<code type="php">
Doctrine::compile();
// on some other script:
require_once("path_to_doctrine/Doctrine.compiled.php");
</code>
<code type='php'>
Doctrine::compile();
// on some other script:
require_once('path_to_doctrine/Doctrine.compiled.php');
</code>
In order to use Doctrine in your project it must first be included.
<code type="php">
require_once("path-to-doctrine/lib/Doctrine.php");
<code type='php'>
require_once('path-to-doctrine/lib/Doctrine.php');
</code>
Doctrine support [http://www.php.net/autoload Autoloading] for including files so that you do not have to include anything more then the base file. There are two different strategies that can be used to do this:
If you do use the **__autoload** function for your own logic you can use it.
<code type="php">
<code type='php'>
function __autoload($class) {
Doctrine::autoload($class);
}
......
......@@ -8,7 +8,7 @@ An short example:
We want to create a database table called 'user' with columns id(primary key), name, username, password and created. Provided that you have already installed Doctrine these few lines of code are all you need:
<code type="php">
<code type='php'>
require_once('lib/Doctrine.php');
spl_autoload_register(array('Doctrine', 'autoload'));
......@@ -18,10 +18,10 @@ class User extends Doctrine_Record {
// set 'user' table columns, note that
// id column is always auto-created
$this->hasColumn("name","string",30);
$this->hasColumn("username","string",20);
$this->hasColumn("password","string",16);
$this->hasColumn("created","integer",11);
$this->hasColumn('name','string',30);
$this->hasColumn('username','string',20);
$this->hasColumn('password','string',16);
$this->hasColumn('created','integer',11);
}
}
</code>
......
Blob (Binary Large OBject) data type is meant to store data of undefined length that may be too large to store in text fields, like data that is usually stored in files.
<br \><br \>
Blob fields are usually not meant to be used as parameters of query search clause (WHERE) unless the underlying DBMS supports a feature usually known as "full text search"
Blob (Binary Large OBject) data type is meant to store data of undefined length that may be too large to store in text fields, like data that is usually stored in files.
<code type="php">
class Test extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('blobtest', 'blob');
}
}
</code>
Blob fields are usually not meant to be used as parameters of query search clause (WHERE) unless the underlying DBMS supports a feature usually known as "full text search"
<code type="php">
class Test extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('blobtest', 'blob');
}
}
</code>
Clob (Character Large OBject) data type is meant to store data of undefined length that may be too large to store in text fields, like data that is usually stored in files.
<br \><br \>
Clob fields are meant to store only data made of printable ASCII characters whereas blob fields are meant to store all types of data.
<br \><br \>
Clob fields are usually not meant to be used as parameters of query search clause (WHERE) unless the underlying DBMS supports a feature usually known as "full text search"
<code type="php">
class Test extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('clobtest', 'clob');
}
}
</code>
Clob (Character Large OBject) data type is meant to store data of undefined length that may be too large to store in text fields, like data that is usually stored in files.
Clob fields are meant to store only data made of printable ASCII characters whereas blob fields are meant to store all types of data.
Clob fields are usually not meant to be used as parameters of query search clause (WHERE) unless the underlying DBMS supports a feature usually known as "full text search"
<code type="php">
class Test extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('clobtest', 'clob');
}
}
</code>
The integer type is the same as integer type in PHP. It may store integer values as large as each DBMS may handle.
<br \><br \>
Fields of this type may be created optionally as unsigned integers but not all DBMS support it.
Therefore, such option may be ignored. Truly portable applications should not rely on the availability of this option.
<br \><br \>
The integer type maps to different database type depending on the column length.
The integer type is the same as integer type in PHP. It may store integer values as large as each DBMS may handle.
<code type="php">
class Test extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('integertest', 'integer', 4, array('unsigned' => true));
}
}
</code>
Fields of this type may be created optionally as unsigned integers but not all DBMS support it.
Therefore, such option may be ignored. Truly portable applications should not rely on the availability of this option.
The integer type maps to different database type depending on the column length.
<code type="php">
class Test extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('integertest', 'integer', 4, array('unsigned' => true));
}
}
</code>
The text data type is available with two options for the length: one that is explicitly length limited and another of undefined length that should be as large as the database allows.
<br \><br \>
The length limited option is the most recommended for efficiency reasons. The undefined length option allows very large fields but may prevent the use of indexes, nullability and may not allow sorting on fields of its type.
<br \><br \>
The fields of this type should be able to handle 8 bit characters. Drivers take care of DBMS specific escaping of characters of special meaning with the values of the strings to be converted to this type.
<br \><br \>
By default Doctrine will use variable length character types. If fixed length types should be used can be controlled via the fixed modifier.
<code type="php">
class Test extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('stringtest', 'string', 200, array('fixed' => true));
}
}
</code>
The text data type is available with two options for the length: one that is explicitly length limited and another of undefined length that should be as large as the database allows.
The length limited option is the most recommended for efficiency reasons. The undefined length option allows very large fields but may prevent the use of indexes, nullability and may not allow sorting on fields of its type.
The fields of this type should be able to handle 8 bit characters. Drivers take care of DBMS specific escaping of characters of special meaning with the values of the strings to be converted to this type.
By default Doctrine will use variable length character types. If fixed length types should be used can be controlled via the fixed modifier.
<code type='php'>
class Test extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('stringtest', 'string', 200, array('fixed' => true));
}
}
</code>
The time data type may represent the time of a given moment of the day. DBMS independent representation of the time of the day is also accomplished by using text strings formatted according to the ISO-8601 standard.
<br \><br \>
The format defined by the ISO-8601 standard for the time of the day is HH:MI:SS where HH is the number of hour the day from 00 to 23 and MI and SS are respectively the number of the minute and of the second from 00 to 59. Hours, minutes and seconds numbered below 10 should be padded on the left with 0.
<br \><br \>
Some DBMS have native support for time of the day formats, but for others the DBMS driver may have to represent them as integers or text values. In any case, it is always possible to make comparisons between time values as well sort query results by fields of this type.
<code type="php">
class Test extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('timetest', 'time');
}
}
</code>
The time data type may represent the time of a given moment of the day. DBMS independent representation of the time of the day is also accomplished by using text strings formatted according to the ISO-8601 standard.
The format defined by the ISO-8601 standard for the time of the day is HH:MI:SS where HH is the number of hour the day from 00 to 23 and MI and SS are respectively the number of the minute and of the second from 00 to 59. Hours, minutes and seconds numbered below 10 should be padded on the left with 0.
Some DBMS have native support for time of the day formats, but for others the DBMS driver may have to represent them as integers or text values. In any case, it is always possible to make comparisons between time values as well sort query results by fields of this type.
<code type="php">
class Test extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('timetest', 'time');
}
}
</code>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment