LINTER backend for Django framework
===================================

LINTER backend for Django is an interface for working 
with RDBMS LINTER (http://www.lintersql.com/)
from web-framework Django (http://www.djangoproject.com/).


Installation
------------

Create subdirectory ``linter`` in ``django\db\backends`` directory 
and copy the files listed below to it:

init.py 
base.py 
client.py
creation.py
introspection.py
query.py

To work with LINTER from Django you need Linpy library
(`LinPy.so` in UNIX or `LinPy.dll` in Win32).
This library is included into RDBMS LINTER distribution kit. 
It supports Python versions 2.1 and higher.


Connecting to the database
--------------------------

Working from Django with Linter is quite similar 
to working from Django with any other RDBMS.

E.g., to create project `mysite` you should submit the following command:

django-admin.py startproject mysite

After execution of this command, `mysite` subdirectory will be created
in the current directory with the following files in it:

__init__.py (needed for Python to consider this directory as a package, 
             i.e. as a group of modules)
manage.py (command line utility to operate the project)
settings.py (current Django project settings)
urls.py (current Django project URL descriptions)

To connect to Linter database from Django project, you should update
settings.py file like the following (assuming that you have database 
DEMO and user SYSTEM with password MANAGER):

DATABASE_ENGINE = 'linter'    
DATABASE_NAME = 'DEMO'    
DATABASE_USER = 'SYSTEM'    
DATABASE_PASSWORD = 'MANAGER'    
DATABASE_HOST = ''    
DATABASE_PORT = ''

To check connection to Linter database after parameter setting 
you should submit the following command from `mysite` project directory: 

python manage.py shell

and then submit the following commands from Python command interpreter:

>>> from django.db import connection
>>> cursor = connection.cursor()

If no diagnostic message appears, connection is OK.
Otherwise, look for problem reason using diagnostic message text.

To execute the command ``python manage.py syncdb``, your LINTER 
database user must have access category ``resource`` or ``dba``. 
To run Django's test suite, the user needs access category ``dba``.    

You can find more information about working with databases 
from Django framework in official Django documentation.


``DateField`` and `DateTimeField`` data
----------------------------------------

All datetime information is stored 
in LINTER database using one `DATE` datatype 
(see http://www.lintersql.com/en/documentation/pdf/sql.pdf). 

By default, LinPy returns all datetime information 
in ``datetime.datetime`` format.
So if you want to get this information in ``datetime.date`` format,
please use LINTER backend function ``set_date_emulation``.
Calling this function with any non-zero parameter 
enables automatic conversion to ``datetime.date`` type 
of ``datetime.datetime`` type values 
containing only year, month and day components. 

These values are used in tests ``serializers`` and ``model_forms``
from Django's test suite, so it can be necessary to add the following 
two lines into the beginning of each such test: 

>>> from django.db import connection
>>> connection.set_date_emulation(1)
