Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
1abc6975
Commit
1abc6975
authored
Feb 11, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated index docs
parent
5744f045
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
29 deletions
+53
-29
Getting started - Indexes - Adding indexes.php
manual/docs/Getting started - Indexes - Adding indexes.php
+6
-15
Getting started - Indexes - Index options.php
manual/docs/Getting started - Indexes - Index options.php
+32
-8
Getting started - Indexes - Introduction.php
manual/docs/Getting started - Indexes - Introduction.php
+3
-2
Getting started - Indexes - Special indexes.php
manual/docs/Getting started - Indexes - Special indexes.php
+2
-4
documentation.php
manual/documentation.php
+10
-0
No files found.
manual/docs/Getting started - Indexes - Adding indexes.php
View file @
1abc6975
<?php
?>
You can add indexes by simple calling Doctrine_Record::option('index', $definition) where $definition is the
definition array. The structure of the definition array is as follows:
<div
class=
'sql'
>
<pre>
[ indexName1 => [col1 => [col1-options], ... , colN => [colN-options]
indexName2 => ...
indexNameN => ]
</pre>
</div>
You can add indexes by simple calling Doctrine_Record::index('indexName', $definition) where $definition is the
definition array.
<br
\
><br
\
>
An example of adding a simple index to field called 'name':
<br
\
><br
\
>
...
...
@@ -21,7 +14,7 @@ class IndexTest extends Doctrine_Record
}
public function setUp()
{
\$
this->
option('index', array('myindex' => 'name')
);
\$
this->
index('myindex', array('fields' => 'name'
);
}
}
?>"
);
...
...
@@ -40,7 +33,7 @@ class MultiColumnIndexTest extends Doctrine_Record
}
public function setUp()
{
\$
this->
option('index', array('myindex
' => array('name', 'code')));
\$
this->
index('myindex', array('fields
' => array('name', 'code')));
}
}
?>"
);
...
...
@@ -60,10 +53,8 @@ class MultipleIndexTest extends Doctrine_Record
}
public function setUp()
{
\$
this->option('index',
array('myindex' => array('name', 'code')
'ageindex' => 'age')
);
\$
this->index('myindex', array('fields' => array('name', 'code')));
\$
this->index('ageindex', array('fields' => array('age'));
}
}
?>"
);
...
...
manual/docs/Getting started - Indexes - Index options.php
View file @
1abc6975
...
...
@@ -2,19 +2,43 @@
Doctrine offers many index options, some of them being db-specific. Here is a full list of availible options:
<div
class=
'sql'
>
<pre>
unique => boolean(true / false)
whether or not the index is unique index
sorting => string('ASC' / 'DESC')
what kind of sorting does the index use (ascending / descending)
length => integer
index length (only some drivers support this)
primary => boolean(true / false)
whether or not the index is primary index
fulltext => boolean(true / false)
whether or not the specified index is a FULLTEXT index (only availible on Mysql)
gist => boolean(true / false)
whether or not the specified index is a GiST index (only availible on Pgsql)
type => string('unique', -- supported by most drivers
'fulltext', -- only availible on Mysql driver
'gist', -- only availible on Pgsql driver
'gin') -- only availible on Pgsql driver
</pre>
</div>
<?php
renderCode
(
"<?php
class MultipleIndexTest extends Doctrine_Record
{
public function setTableDefinition()
{
\$
this->hasColumn('name', 'string');
\$
this->hasColumn('code', 'string');
\$
this->hasColumn('age', 'integer');
}
public function setUp()
{
\$
this->index('myindex', array(
'fields' => array(
'name' =>
array('sorting' => 'ASC',
'length' => 10),
'code'),
'type' => 'unique',
));
}
}
?>"
);
?>
manual/docs/Getting started - Indexes - Introduction.php
View file @
1abc6975
...
...
@@ -5,4 +5,5 @@ The larger the table, the more this consumes time. If the table has an index for
can
quickly
determine
the
position
to
seek
to
in
the
middle
of
the
data
file
without
having
to
look
at
all
the
data
.
If
a
table
has
1
,
000
rows
,
this
is
at
least
100
times
faster
than
reading
rows
one
-
by
-
one
.
<
br
\
><
br
\
>
You
should
*<
b
>
always
</
b
>*
use
indexes
for
the
fields
that
are
used
in
sql
where
conditions
.
Indexes
come
with
a
cost
as
they
slow
down
the
inserts
and
updates
.
However
,
in
general
you
should
*<
b
>
always
</
b
>*
use
indexes
for
the
fields
that
are
used
in
sql
where
conditions
.
manual/docs/Getting started - Indexes - Special indexes.php
View file @
1abc6975
...
...
@@ -13,10 +13,8 @@ class Article
}
public function setUp()
{
\$
this->option('index',
array('content' =>
array('content' =>
array('fulltext' => true));
\$
this->index('content', array('fields' => 'content',
'type' => 'fulltext'));
}
}
?>"
);
manual/documentation.php
View file @
1abc6975
...
...
@@ -109,6 +109,11 @@ $menu = array('Getting started' =>
'Default values'
,
'Enum emulation'
,
),
'Working with existing databases'
=>
array
(
'Introduction'
,
'Making the first import'
,
'Import options'
,
),
'Record identifiers'
=>
array
(
'Introduction'
,
...
...
@@ -122,6 +127,8 @@ $menu = array('Getting started' =>
'Index options'
,
'Special indexes'
,
),
),
'Connection management'
=>
array
(
...
...
@@ -149,6 +156,9 @@ $menu = array('Getting started' =>
'Enum'
,
'Gzip'
,
),
'Foreign keys'
=>
array
(
'Introduction'
,
),
/**
'Column attributes' => array(
'Introduction',
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment