#

# TODO

- RelatedJoin.hasOther(otherObject[.id])

- createParamsPre/Post:

      class MyTable(SQLObject):
          class sqlmeta:
              createParamsPre = 'TEMPORARY IF NOT EXISTS'
              createParamsPre = {temporary: True, ifNotExists: True,
                                 'postgres': 'LOCAL'}
              createParamsPost = 'ENGINE InnoDB'
              createParamsPost = {'mysql': 'ENGINE InnoDB',
                                  'postgres': 'WITH OIDS'}

- SQLObject.fastInsert().

- List databases in the connection.

- List tables/indices in the DB. The query in MySQL is `SHOW TABLES`; in SQLite it is

  > SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;

  and in Postgres it is something like

  > SELECT c.relname FROM pg_class c, pg_type t WHERE c.reltype = t.oid AND t.typname = 'table'.

- IntervalCol

- TimedeltaCol

- Cached join results.

- Invert tests isinstance(obj, (tuple, list)) to not isinstance(obj, basestr) to allow any iterable.

- Always use .lazyIter().

- Optimize Iteration.next() - use cursor.fetchmany().

- Generators instead of loops (fetchall => fetchone).

- Cache columns in sqlmeta.getColumns(); reset the cache on add/del Column/Join.

- Stop supporting Python 2.5: remove import sets; use `with lock`; make ConnectionHub a context manager instead of .doInTransaction(); replace time.strptime with datetime.strptime. Upgrade ez_setup to 2.0+.

- Create JSONCol.

- Make version_info a namedtuple.

- Stop supporting Python 2.6: restore using urllib.splituser in _parseURI.

- Expression columns - in SELECT but not in INSERT/UPDATE. Something like this:

      class MyClass(SQLObject):
          function1 = ExpressionCol(func.my_function(MyClass.q.col1))
          function2 = ExpressionCol('sum(col2)')

- A hierarchy of exceptions. SQLObject should translate exceptions from low-level drivers to a consistent set of high-level exceptions.

- Memcache.

- Refactor `DBConnection` to use parameterized queries instead of generating query strings.

- PREPARE/EXECUTE.

- Protect all .encode(), catch UnicodeEncode exceptions and reraise Invalid.

- More kinds of joins, and more powerful join results (closer to how select works).

- Better joins - automatic joins in .select() based on ForeignKey/MultipleJoin/RelatedJoin.

- Deprecate, then remove connectionForOldURI.

- Python 3.0+.

- Switch from setuptools to distribute.

- oursql MySQL bindings: https://launchpad.net/oursql

- MySQL Connector/Python: https://launchpad.net/myconnpy

- Pure Python Mysql Interface: https://github.com/nasi/MyPy

- pg8000 driver: http://code.google.com/p/pg8000/

- py-postgresql driver: http://python.projects.postgresql.org/

- pyfirebirdsql: https://github.com/nakagami/pyfirebirdsql

- dict API: use getitem interface for column access instead of getattr; reserve getattr for internal attributes only; this helps to avoid collisions with internal attributes.

- Or move column values access to a separate namespace, e.g. .c: row.c.column.

- Convert documentation to Sphinx format and publish it on http://readthedocs.org/

- More documentation. Wiki. Trac.
- RSS 2.0 and Atom news feeds.
- Use DBUtils, especially SolidConnection.

- `_fromDatabase` currently doesn't support IDs that don't fit into the normal naming scheme. It should do so. You can still use `_idName` with `_fromDatabase`.
- More databases supported. There has been interest and some work in the progress for Oracle. IWBN to have Informix and DB2 drivers.
- Better transaction support -- right now you can use transactions for the database, but objects aren't transaction-aware, so non-database persistence won't be able to be rolled back.
- Optimistic locking and other techniques to handle concurrency.
- Profile of SQLObject performance to identify bottlenecks.
- Increase hooks with FormEncode validation and form generation package, so SQLObject classes (read: schemas) can be published for editing more directly and easily. (First step: get Schema-generating method into sqlmeta class)
- Merge SQLObject.create*, .create*SQL methods with DBPI.create* methods.
- Made SQLObject unicode-based instead of just unicode-aware. All internal processing should be done with unicode strings, conversion to/from ascii strings should happen for non-unicode DB API drivers.
- Allow to override ConsoleWriter/LogWriter classes and makeDebugWriter function.