Commit 3558e3bd authored by Phil Davis's avatar Phil Davis

Doc typos and grammar

parent 7e16187a
...@@ -24,7 +24,7 @@ require this instance, while the later has this instance as a required parameter ...@@ -24,7 +24,7 @@ require this instance, while the later has this instance as a required parameter
$stmt = $conn->executeQuery($query, $params, $types, new QueryCacheProfile(0, "some key")); $stmt = $conn->executeQuery($query, $params, $types, new QueryCacheProfile(0, "some key"));
$stmt = $conn->executeCacheQuery($query, $params, $types, new QueryCacheProfile(0, "some key")); $stmt = $conn->executeCacheQuery($query, $params, $types, new QueryCacheProfile(0, "some key"));
It is also possible to pass in a the ``Doctrine\Common\Cache\Cache`` instance into the It is also possible to pass in a ``Doctrine\Common\Cache\Cache`` instance into the
constructor of ``Doctrine\DBAL\Cache\QueryCacheProfile`` in which case it overrides constructor of ``Doctrine\DBAL\Cache\QueryCacheProfile`` in which case it overrides
the default cache instance: the default cache instance:
...@@ -35,7 +35,7 @@ the default cache instance: ...@@ -35,7 +35,7 @@ the default cache instance:
new QueryCacheProfile(0, "some key", $cache); new QueryCacheProfile(0, "some key", $cache);
In order for the data to actually be cached its necessary to ensure that the entire In order for the data to actually be cached its necessary to ensure that the entire
result set is read (easiest way to ensure this is to use ``fetchAll``) and the statement result set is read (the easiest way to ensure this is to use ``fetchAll``) and the statement
object is closed: object is closed:
:: ::
......
...@@ -77,7 +77,7 @@ If you wanted to use the ``drizzle_pdo__mysql`` driver instead:: ...@@ -77,7 +77,7 @@ If you wanted to use the ``drizzle_pdo__mysql`` driver instead::
drizzle-pdo-mysql://localhost:4486/foo?charset=UTF-8 drizzle-pdo-mysql://localhost:4486/foo?charset=UTF-8
In the two last example above, mind the dashes instead of the In the last two examples above, mind the dashes instead of the
underscores in the URL schemes. underscores in the URL schemes.
For connecting to an SQLite database, the authority portion of the For connecting to an SQLite database, the authority portion of the
...@@ -155,8 +155,8 @@ Wrapper Class ...@@ -155,8 +155,8 @@ Wrapper Class
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
By default a ``Doctrine\DBAL\Connection`` is wrapped around a By default a ``Doctrine\DBAL\Connection`` is wrapped around a
driver ``Connection``. The ``wrapperClass`` option allows to driver ``Connection``. The ``wrapperClass`` option allows
specify a custom wrapper implementation to use, however, a custom specifying a custom wrapper implementation to use, however, a custom
wrapper class must be a subclass of ``Doctrine\DBAL\Connection``. wrapper class must be a subclass of ``Doctrine\DBAL\Connection``.
Connection Details Connection Details
...@@ -208,7 +208,7 @@ drizzle\_pdo\_mysql ...@@ -208,7 +208,7 @@ drizzle\_pdo\_mysql
**Requires** drizzle plugin ``mysql_protocol`` or ``mysql_unix_socket_protocol`` to be enabled. **Requires** drizzle plugin ``mysql_protocol`` or ``mysql_unix_socket_protocol`` to be enabled.
On Ubuntu this can be done by editing ``/etc/drizzle/conf.d/mysql-protocol.cnf`` On Ubuntu this can be done by editing ``/etc/drizzle/conf.d/mysql-protocol.cnf``
or ``/etc/drizzle/conf.d/mysql-unix-socket-protocol.cnf`` and restart drizzled daemon. or ``/etc/drizzle/conf.d/mysql-unix-socket-protocol.cnf`` and restarting the drizzled daemon.
- ``user`` (string): Username to use when connecting to the - ``user`` (string): Username to use when connecting to the
database. Only needed if authentication is configured for drizzled. database. Only needed if authentication is configured for drizzled.
......
...@@ -59,7 +59,7 @@ several drawbacks: ...@@ -59,7 +59,7 @@ several drawbacks:
you will trigger the optimization process over and over again, although you will trigger the optimization process over and over again, although
it could re-use this information easily using a technique called **prepared statements**. it could re-use this information easily using a technique called **prepared statements**.
This three arguments and some more technical details hopefully convinced you to investigate These three arguments and some more technical details hopefully convinced you to investigate
prepared statements for accessing your database. prepared statements for accessing your database.
Dynamic Parameters and Prepared Statements Dynamic Parameters and Prepared Statements
...@@ -179,7 +179,7 @@ on the Connection, which are all described in the API section below. ...@@ -179,7 +179,7 @@ on the Connection, which are all described in the API section below.
Binding Types Binding Types
------------- -------------
Doctrine DBAL extends PDOs handling of binding types in prepared statement Doctrine DBAL extends PDOs handling of binding types in prepared statements
considerably. Besides the well known ``\PDO::PARAM_*`` constants you considerably. Besides the well known ``\PDO::PARAM_*`` constants you
can make use of two very powerful additional features. can make use of two very powerful additional features.
...@@ -202,7 +202,7 @@ to the appropriate vendors database format: ...@@ -202,7 +202,7 @@ to the appropriate vendors database format:
$stmt->execute(); $stmt->execute();
If you take a look at ``Doctrine\DBAL\Types\DateTimeType`` you will see that If you take a look at ``Doctrine\DBAL\Types\DateTimeType`` you will see that
parts of the conversion is delegated to a method on the current database platform, parts of the conversion are delegated to a method on the current database platform,
which means this code works independent of the database you are using. which means this code works independent of the database you are using.
.. note:: .. note::
...@@ -250,7 +250,7 @@ There are two special binding types that describe a list of integers or strings: ...@@ -250,7 +250,7 @@ There are two special binding types that describe a list of integers or strings:
- ``\Doctrine\DBAL\Connection::PARAM_INT_ARRAY`` - ``\Doctrine\DBAL\Connection::PARAM_INT_ARRAY``
- ``\Doctrine\DBAL\Connection::PARAM_STR_ARRAY`` - ``\Doctrine\DBAL\Connection::PARAM_STR_ARRAY``
Using one of this constants as a type you can activate the SQLParser inside Doctrine that rewrites Using one of these constants as a type you can activate the SQLParser inside Doctrine that rewrites
the SQL and flattens the specified values into the set of parameters. Consider our previous example: the SQL and flattens the specified values into the set of parameters. Consider our previous example:
.. code-block:: php .. code-block:: php
......
...@@ -44,7 +44,7 @@ Schema Events ...@@ -44,7 +44,7 @@ Schema Events
There are multiple events in Doctrine DBAL that are triggered on schema changes There are multiple events in Doctrine DBAL that are triggered on schema changes
of the database. It is possible to add your own event listener to be able to run of the database. It is possible to add your own event listener to be able to run
your own code before changes to the database are commited. An instance of your own code before changes to the database are committed. An instance of
``Doctrine\Common\EventManager`` can also be added to :doc:`platforms`. ``Doctrine\Common\EventManager`` can also be added to :doc:`platforms`.
A event listener class can contain one or more methods to schema events. These A event listener class can contain one or more methods to schema events. These
......
...@@ -12,7 +12,7 @@ DateTime, DateTimeTz and Time Types ...@@ -12,7 +12,7 @@ DateTime, DateTimeTz and Time Types
Postgres has a variable return format for the datatype TIMESTAMP(n) Postgres has a variable return format for the datatype TIMESTAMP(n)
and TIME(n) if microseconds are allowed (n > 0). Whenever you save and TIME(n) if microseconds are allowed (n > 0). Whenever you save
a value with microseconds = 0. PostgreSQL will return this value in a value with microseconds = 0, PostgreSQL will return this value in
the format: the format:
:: ::
...@@ -72,7 +72,7 @@ DateTimeTz ...@@ -72,7 +72,7 @@ DateTimeTz
~~~~~~~~~~ ~~~~~~~~~~
MySQL does not support saving timezones or offsets. The DateTimeTz MySQL does not support saving timezones or offsets. The DateTimeTz
type therefore behave like the DateTime type. type therefore behaves like the DateTime type.
Sqlite Sqlite
------ ------
...@@ -80,7 +80,7 @@ Sqlite ...@@ -80,7 +80,7 @@ Sqlite
Buffered Queries and Isolation Buffered Queries and Isolation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Careful if you execute a ``SELECT`` query and do not iterate over the Be careful if you execute a ``SELECT`` query and do not iterate over the
statements results immediately. ``UPDATE`` statements executed before iteration statements results immediately. ``UPDATE`` statements executed before iteration
affect only the rows that have not been buffered into PHP memory yet. This affect only the rows that have not been buffered into PHP memory yet. This
breaks the SERIALIZABLE transaction isolation property that SQLite supposedly breaks the SERIALIZABLE transaction isolation property that SQLite supposedly
...@@ -106,7 +106,7 @@ DateTimeTz ...@@ -106,7 +106,7 @@ DateTimeTz
~~~~~~~~~~ ~~~~~~~~~~
Sqlite does not support saving timezones or offsets. The DateTimeTz Sqlite does not support saving timezones or offsets. The DateTimeTz
type therefore behave like the DateTime type. type therefore behaves like the DateTime type.
Reverse engineering primary key order Reverse engineering primary key order
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
...@@ -13,7 +13,7 @@ system this allows you to generate SQL code that makes your Domain ...@@ -13,7 +13,7 @@ system this allows you to generate SQL code that makes your Domain
model work. model work.
You will be pleased to hear, that Schema representation is You will be pleased to hear, that Schema representation is
completly decoupled from the Doctrine ORM though, that is you can completely decoupled from the Doctrine ORM though, that is you can
also use it in any other project to implement database migrations also use it in any other project to implement database migrations
or for SQL schema generation for any metadata model that your or for SQL schema generation for any metadata model that your
application has. You can easily generate a Schema, as a simple application has. You can easily generate a Schema, as a simple
...@@ -53,13 +53,13 @@ foreign key, sequence and index changes. ...@@ -53,13 +53,13 @@ foreign key, sequence and index changes.
$saveQueries = $schemaDiff->toSaveSql($myPlatform); $saveQueries = $schemaDiff->toSaveSql($myPlatform);
The Save Diff mode is a specific mode that prevents the deletion of The Save Diff mode is a specific mode that prevents the deletion of
tables and sequences that might occour when making a diff of your tables and sequences that might occur when making a diff of your
schema. This is often necessary when your target schema is not schema. This is often necessary when your target schema is not
complete but only describes a subset of your application. complete but only describes a subset of your application.
All methods that generate SQL queries for you make much effort to All methods that generate SQL queries for you make much effort to
get the order of generation correct, so that no problems will ever get the order of generation correct, so that no problems will ever
occour with missing links of foreign keys. occur with missing links of foreign keys.
Schema Assets Schema Assets
------------- -------------
......
...@@ -19,7 +19,7 @@ to prevent them. ...@@ -19,7 +19,7 @@ to prevent them.
SQL Injection: Safe and Unsafe APIs for User Input SQL Injection: Safe and Unsafe APIs for User Input
-------------------------------------------------- --------------------------------------------------
A database library naturally falls touches the class of SQL injection security A database library naturally touches the class of SQL injection security
vulnerabilities. You should read the following information carefully to vulnerabilities. You should read the following information carefully to
understand how Doctrine can and cannot help you to prevent SQL injection. understand how Doctrine can and cannot help you to prevent SQL injection.
...@@ -48,8 +48,8 @@ To escape user input in those scenarios use the ``Connection#quote()`` method. ...@@ -48,8 +48,8 @@ To escape user input in those scenarios use the ``Connection#quote()`` method.
User input in your queries User input in your queries
-------------------------- --------------------------
A database application necessarily requires user-input to passed to your queries. A database application necessarily requires user-input to be passed to your queries.
There are wrong and right ways to do this and is very important to be very strict about this: There are wrong and right ways to do this and it is very important to be very strict about this:
Wrong: String Concatenation Wrong: String Concatenation
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
...@@ -65,7 +65,7 @@ SQL or DQL query. For Example: ...@@ -65,7 +65,7 @@ SQL or DQL query. For Example:
An attacker could inject any value into the GET variable "username" to modify the query to his needs. An attacker could inject any value into the GET variable "username" to modify the query to his needs.
Although DQL is a wrapper around SQL that can prevent you from some security implications, the previous Although DQL is a wrapper around SQL that can prevent some security implications, the previous
example is also a threat to DQL queries. example is also a threat to DQL queries.
.. code-block:: php .. code-block:: php
...@@ -83,11 +83,11 @@ Right: Prepared Statements ...@@ -83,11 +83,11 @@ Right: Prepared Statements
~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~
You should always use prepared statements to execute your queries. Prepared statements is a two-step You should always use prepared statements to execute your queries. Prepared statements is a two-step
procedure, separating SQL query from the parameters. They are supported (and encouraged) for both procedure, separating the SQL query from the parameters. They are supported (and encouraged) for both
DBAL SQL queries and for ORM DQL queries. DBAL SQL queries and for ORM DQL queries.
Instead of using string concatenation to insert user-input into your SQL/DQL statements you just specify Instead of using string concatenation to insert user-input into your SQL/DQL statements you just specify
either placeholders instead and then explain to the database driver which variable should be bound to placeholders and then explain to the database driver which variable should be bound to
which placeholder. Each database vendor supports different placeholder styles: which placeholder. Each database vendor supports different placeholder styles:
- All PDO Drivers support positional (using question marks) and named placeholders (:param1, :foo, :bar). - All PDO Drivers support positional (using question marks) and named placeholders (:param1, :foo, :bar).
...@@ -153,5 +153,5 @@ the ``Connection#quote`` method: ...@@ -153,5 +153,5 @@ the ``Connection#quote`` method:
// Parameter quoting // Parameter quoting
$sql = "SELECT * FROM users WHERE name = " . $connection->quote($_GET['username'], \PDO::PARAM_STR); $sql = "SELECT * FROM users WHERE name = " . $connection->quote($_GET['username'], \PDO::PARAM_STR);
This method is only available for SQL, not for DQL. For DQL it is always encouraged to use prepared This method is only available for SQL, not for DQL. For DQL you are always encouraged to use prepared
statements not only for security, but also for caching reasons. statements not only for security, but also for caching reasons.
\ No newline at end of file
...@@ -3,7 +3,7 @@ Sharding ...@@ -3,7 +3,7 @@ Sharding
.. note:: .. note::
The sharding extension is currently in transition from a seperate Project The sharding extension is currently in transition from a separate Project
into DBAL. Class names may differ. into DBAL. Class names may differ.
Starting with 2.3 Doctrine DBAL contains some functionality to simplify the Starting with 2.3 Doctrine DBAL contains some functionality to simplify the
......
...@@ -3,7 +3,7 @@ SQLAzure Sharding Tutorial ...@@ -3,7 +3,7 @@ SQLAzure Sharding Tutorial
.. note:: .. note::
The sharding extension is currently in transition from a seperate Project The sharding extension is currently in transition from a separate Project
into DBAL. Class names may differ. into DBAL. Class names may differ.
This tutorial builds upon the `Brian Swans tutorial This tutorial builds upon the `Brian Swans tutorial
...@@ -89,7 +89,7 @@ to create the database schema and then have Doctrine turn it into DDL ...@@ -89,7 +89,7 @@ to create the database schema and then have Doctrine turn it into DDL
statements. statements.
We will recreate Brians example schema with Doctrine DBAL. Instead of having to We will recreate Brians example schema with Doctrine DBAL. Instead of having to
create federations and schema seperately as in his example, Doctrine will do it create federations and schema separately as in his example, Doctrine will do it
all in one step: all in one step:
.. code-block:: php .. code-block:: php
......
...@@ -34,5 +34,5 @@ Implementation Steps in Detail ...@@ -34,5 +34,5 @@ Implementation Steps in Detail
2. Make a copy of tests/dbproperties.xml.dev and adjust the values to your driver shortcut and testdatabase. 2. Make a copy of tests/dbproperties.xml.dev and adjust the values to your driver shortcut and testdatabase.
3. Create three new classes implementing ``\Doctrine\DBAL\Driver\Connection``, ``\Doctrine\DBAL\Driver\Statement`` 3. Create three new classes implementing ``\Doctrine\DBAL\Driver\Connection``, ``\Doctrine\DBAL\Driver\Statement``
and ``Doctrine\DBAL\Driver``. You can take a look at the ``Doctrine\DBAL\Driver\OCI8`` driver. and ``Doctrine\DBAL\Driver``. You can take a look at the ``Doctrine\DBAL\Driver\OCI8`` driver.
4. You can run the testsuite of your new database driver by calling "phpunit -c .". You can set your own settings in phpunit.xml file. 4. You can run the testsuite of your new database driver by calling "phpunit -c .". You can set your own settings in the phpunit.xml file.
5. Start implementing AbstractPlatform and AbstractSchemaManager. Other implementations should serve as good example. 5. Start implementing AbstractPlatform and AbstractSchemaManager. Other implementations should serve as good examples.
...@@ -410,7 +410,7 @@ using comma delimited ``explode()`` or ``null`` if no data is present. ...@@ -410,7 +410,7 @@ using comma delimited ``explode()`` or ``null`` if no data is present.
the database as the ``explode()`` deserialization technique used the database as the ``explode()`` deserialization technique used
by this type converts every single array item to ``string``. by this type converts every single array item to ``string``.
This basically means that every array item other than ``string`` This basically means that every array item other than ``string``
will loose its type awareness. will lose its type awareness.
json json
^^^^ ^^^^
...@@ -927,7 +927,7 @@ Now we implement our ``Doctrine\DBAL\Types\Type`` instance: ...@@ -927,7 +927,7 @@ Now we implement our ``Doctrine\DBAL\Types\Type`` instance:
} }
} }
The job of Doctrine-DBAL is to transform your type into SQL declaration. You can modify the SQL declaration Doctrine will produce. At first, you must to enable this feature by overriding the canRequireSQLConversion method: The job of Doctrine-DBAL is to transform your type into an SQL declaration. You can modify the SQL declaration Doctrine will produce. At first, to enable this feature, you must override the canRequireSQLConversion method:
:: ::
...@@ -962,7 +962,7 @@ hook it into the database platform: ...@@ -962,7 +962,7 @@ hook it into the database platform:
Type::addType('money', 'My\Project\Types\MoneyType'); Type::addType('money', 'My\Project\Types\MoneyType');
$conn->getDatabasePlatform()->registerDoctrineTypeMapping('MyMoney', 'money'); $conn->getDatabasePlatform()->registerDoctrineTypeMapping('MyMoney', 'money');
This would allow to use a money type in the ORM for example and This would allow using a money type in the ORM for example and
have Doctrine automatically convert it back and forth to the have Doctrine automatically convert it back and forth to the
database. database.
......
...@@ -44,7 +44,7 @@ $orderItems->addOption('azure.federatedOnColumnName', 'CustomerID'); ...@@ -44,7 +44,7 @@ $orderItems->addOption('azure.federatedOnColumnName', 'CustomerID');
// Create the Schema + Federation: // Create the Schema + Federation:
$synchronizer = new SQLAzureSchemaSynchronizer($conn, $shardManager); $synchronizer = new SQLAzureSchemaSynchronizer($conn, $shardManager);
// Or jut look at the SQL: // Or just look at the SQL:
echo implode("\n", $synchronizer->getCreateSchema($schema)); echo implode("\n", $synchronizer->getCreateSchema($schema));
$synchronizer->createSchema($schema); $synchronizer->createSchema($schema);
......
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