[1.8.x] Made assorted improvements to the Oracle documentation.

Backport of 6f1b09bb5c from master
This commit is contained in:
Mariusz Felisiak 2015-09-15 22:01:31 +02:00 committed by Tim Graham
parent eb0bbb8f3a
commit a0ce708c1c
5 changed files with 28 additions and 18 deletions

View File

@ -201,8 +201,9 @@ and creates any necessary database tables according to the database settings
in your :file:`mysite/settings.py` file and the database migrations shipped in your :file:`mysite/settings.py` file and the database migrations shipped
with the app (we'll cover those later). You'll see a message for each with the app (we'll cover those later). You'll see a message for each
migration it applies. If you're interested, run the command-line client for your migration it applies. If you're interested, run the command-line client for your
database and type ``\dt`` (PostgreSQL), ``SHOW TABLES;`` (MySQL), or database and type ``\dt`` (PostgreSQL), ``SHOW TABLES;`` (MySQL), ``.schema``
``.schema`` (SQLite) to display the tables Django created. (SQLite), or ``SELECT TABLE_NAME FROM USER_TABLES;`` (Oracle) to display the
tables Django created.
.. admonition:: For the minimalists .. admonition:: For the minimalists
@ -518,7 +519,7 @@ Note the following:
* It's tailored to the database you're using, so database-specific field types * It's tailored to the database you're using, so database-specific field types
such as ``auto_increment`` (MySQL), ``serial`` (PostgreSQL), or ``integer such as ``auto_increment`` (MySQL), ``serial`` (PostgreSQL), or ``integer
primary key autoincrement`` (SQLite) are handled for you automatically. Same primary key autoincrement`` (SQLite) are handled for you automatically. Same
goes for the quoting of field names -- e.g., using double quotes or goes for the quoting of field names -- e.g., using double quotes or
single quotes. single quotes.
* The :djadmin:`sqlmigrate` command doesn't actually run the migration on your * The :djadmin:`sqlmigrate` command doesn't actually run the migration on your
@ -565,9 +566,9 @@ but for now, remember the three-step guide to making model changes:
* Run :djadmin:`python manage.py migrate <migrate>` to apply those changes to * Run :djadmin:`python manage.py migrate <migrate>` to apply those changes to
the database. the database.
The reason that there are separate commands to make and apply migrations is The reason that there are separate commands to make and apply migrations is
because you'll commit migrations to your version control system and ship them because you'll commit migrations to your version control system and ship them
with your app; they not only make your development easier, they're also with your app; they not only make your development easier, they're also
useable by other developers and in production. useable by other developers and in production.
Read the :doc:`django-admin documentation </ref/django-admin>` for full Read the :doc:`django-admin documentation </ref/django-admin>` for full

View File

@ -762,13 +762,15 @@ for Django's own test suite.
All of these privileges are included in the DBA role, which is appropriate All of these privileges are included in the DBA role, which is appropriate
for use on a private developer's database. for use on a private developer's database.
The Oracle database backend uses the ``SYS.DBMS_LOB`` package, so your user The Oracle database backend uses the ``SYS.DBMS_LOB`` and ``SYS.DBMS_RANDOM``
will require execute permissions on it. It's normally accessible to all users packages, so your user will require execute permissions on it. It's normally
by default, but in case it is not, you'll need to grant permissions like so: accessible to all users by default, but in case it is not, you'll need to grant
permissions like so:
.. code-block:: sql .. code-block:: sql
GRANT EXECUTE ON SYS.DBMS_LOB TO user; GRANT EXECUTE ON SYS.DBMS_LOB TO user;
GRANT EXECUTE ON SYS.DBMS_RANDOM TO user;
Connecting to the database Connecting to the database
-------------------------- --------------------------
@ -892,10 +894,10 @@ some limitations on the usage of such LOB columns in general:
* LOB columns may not be used in a ``SELECT DISTINCT`` list. This means that * LOB columns may not be used in a ``SELECT DISTINCT`` list. This means that
attempting to use the ``QuerySet.distinct`` method on a model that attempting to use the ``QuerySet.distinct`` method on a model that
includes ``TextField`` columns will result in an error when run against includes ``TextField`` columns will result in an ``ORA-00932`` error when
Oracle. As a workaround, use the ``QuerySet.defer`` method in conjunction run against Oracle. As a workaround, use the ``QuerySet.defer`` method in
with ``distinct()`` to prevent ``TextField`` columns from being included in conjunction with ``distinct()`` to prevent ``TextField`` columns from being
the ``SELECT DISTINCT`` list. included in the ``SELECT DISTINCT`` list.
.. _third-party-notes: .. _third-party-notes:

View File

@ -217,11 +217,12 @@ Runs the command-line client for the database engine specified in your
* For PostgreSQL, this runs the ``psql`` command-line client. * For PostgreSQL, this runs the ``psql`` command-line client.
* For MySQL, this runs the ``mysql`` command-line client. * For MySQL, this runs the ``mysql`` command-line client.
* For SQLite, this runs the ``sqlite3`` command-line client. * For SQLite, this runs the ``sqlite3`` command-line client.
* For Oracle, this runs the ``sqlplus`` command-line client.
This command assumes the programs are on your ``PATH`` so that a simple call to This command assumes the programs are on your ``PATH`` so that a simple call to
the program name (``psql``, ``mysql``, ``sqlite3``) will find the program in the program name (``psql``, ``mysql``, ``sqlite3``, ``sqlplus``) will find the
the right place. There's no way to specify the location of the program program in the right place. There's no way to specify the location of the
manually. program manually.
The :djadminopt:`--database` option can be used to specify the database The :djadminopt:`--database` option can be used to specify the database
onto which to open a shell. onto which to open a shell.

View File

@ -732,7 +732,7 @@ object. If it's ``None``, Django uses the :ref:`current time zone
.. _pytz: http://pytz.sourceforge.net/ .. _pytz: http://pytz.sourceforge.net/
.. _Time Zones: http://www.postgresql.org/docs/current/static/datatype-datetime.html#DATATYPE-TIMEZONES .. _Time Zones: http://www.postgresql.org/docs/current/static/datatype-datetime.html#DATATYPE-TIMEZONES
.. _Choosing a Time Zone File: http://docs.oracle.com/cd/B19306_01/server.102/b14225/ch4datetime.htm#i1006667 .. _Choosing a Time Zone File: http://docs.oracle.com/cd/E11882_01/server.112/e10729/ch4datetime.htm#NLSPG258
.. _mysql_tzinfo_to_sql: http://dev.mysql.com/doc/refman/5.6/en/mysql-tzinfo-to-sql.html .. _mysql_tzinfo_to_sql: http://dev.mysql.com/doc/refman/5.6/en/mysql-tzinfo-to-sql.html
none none
@ -2732,7 +2732,7 @@ SQL equivalents::
SELECT ... WHERE title REGEXP BINARY '^(An?|The) +'; -- MySQL SELECT ... WHERE title REGEXP BINARY '^(An?|The) +'; -- MySQL
SELECT ... WHERE REGEXP_LIKE(title, '^(an?|the) +', 'c'); -- Oracle SELECT ... WHERE REGEXP_LIKE(title, '^(An?|The) +', 'c'); -- Oracle
SELECT ... WHERE title ~ '^(An?|The) +'; -- PostgreSQL SELECT ... WHERE title ~ '^(An?|The) +'; -- PostgreSQL

View File

@ -23,11 +23,17 @@ able to store certain characters in the database, and information will be lost.
* PostgreSQL users, refer to the `PostgreSQL manual`_ (section 22.3.2 in * PostgreSQL users, refer to the `PostgreSQL manual`_ (section 22.3.2 in
PostgreSQL 9) for details on creating databases with the correct encoding. PostgreSQL 9) for details on creating databases with the correct encoding.
* Oracle users, refer to the `Oracle manual`_ for details on how to set
(`section 2`_) or alter (`section 11`_) the database character set encoding.
* SQLite users, there is nothing you need to do. SQLite always uses UTF-8 * SQLite users, there is nothing you need to do. SQLite always uses UTF-8
for internal encoding. for internal encoding.
.. _MySQL manual: http://dev.mysql.com/doc/refman/5.6/en/charset-database.html .. _MySQL manual: http://dev.mysql.com/doc/refman/5.6/en/charset-database.html
.. _PostgreSQL manual: http://www.postgresql.org/docs/current/static/multibyte.html .. _PostgreSQL manual: http://www.postgresql.org/docs/current/static/multibyte.html
.. _Oracle manual: http://docs.oracle.com/cd/E11882_01/server.112/e10729/toc.htm
.. _section 2: http://docs.oracle.com/cd/E11882_01/server.112/e10729/ch2charset.htm#NLSPG002
.. _section 11: http://docs.oracle.com/cd/E11882_01/server.112/e10729/ch11charsetmig.htm#NLSPG011
All of Django's database backends automatically convert Unicode strings into All of Django's database backends automatically convert Unicode strings into
the appropriate encoding for talking to the database. They also automatically the appropriate encoding for talking to the database. They also automatically