# Path: sesql/config.py
# CONFIG_PATH_FALLBACK = 'sesql_config'
#     CONFIG_PATH = getattr(settings, 'SESQL_CONFIG_PATH', CONFIG_PATH_FALLBACK)
#     CONFIG_PATH = CONFIG_PATH_FALLBACK
# 
# Path: sesql/typemap.py
# class TypeMap(object):
#     def __init__(self):
#     def all_subclasses(klass, done = None):
#     def all_tables(self):
#     def all_classes(self):
#     def all_class_names(self):
#     def get_class_names_for(self, table):
#     def get_classes_for(self, table):
#     def get_table_for(self, klass):
#     def get_class_by_name(self, klass):
# 
# Path: sesql/utils.py
# def print_eta(percent, timedelta):
#     """
#     Print an ETA line, given we did percent of total in timedelta
#     """
#     if percent == 100.0 or percent == 0.0:
#         eta = 0
#     else:
#         eta = timedelta / percent * (100.0 - percent)
# 
#     print "%05.2f %% done in %s; ETA : %s" % (percent,
#                                               format_time(timedelta),
#                                               format_time(eta))


import sys
import time
from optparse import make_option
from django.db import transaction
from django.core.management.base import BaseCommand
from sesql import config
from sesql import typemap
from sesql.utils import print_eta
                    help='Delay between two steps (default: 0.1 s) '),
        make_option('--source',
                    dest='source',
                    default=None,
                    help='Name of the source field'),
        make_option('--target',
                    dest='target',
                    default=None,
                    help='Name of the target field'),
        )

    @transaction.commit_on_success
    def iteration(self, table, idmin, idmax):
        """
        Perform one iteration : reindex everything
        """
        cursor = config.orm.cursor()
        query = '''
        UPDATE %s
        SET %s = %s
        WHERE %s IS NULL
        AND (id >= %d) AND (id <= %d)
        ''' % (table, self.target, self.source, self.target, idmin, idmax)
        cursor.execute(query)

    def process_table(self, table):
        """
        Process on given table
        """


# Path: sesql/config.py
# CONFIG_PATH_FALLBACK = 'sesql_config'
#     CONFIG_PATH = getattr(settings, 'SESQL_CONFIG_PATH', CONFIG_PATH_FALLBACK)
#     CONFIG_PATH = CONFIG_PATH_FALLBACK
# 
# Path: sesql/typemap.py
# class TypeMap(object):
#     def __init__(self):
#     def all_subclasses(klass, done = None):
#     def all_tables(self):
#     def all_classes(self):
#     def all_class_names(self):
#     def get_class_names_for(self, table):
#     def get_classes_for(self, table):
#     def get_table_for(self, klass):
#     def get_class_by_name(self, klass):
# 
# Path: sesql/utils.py
# def print_eta(percent, timedelta):
#     """
#     Print an ETA line, given we did percent of total in timedelta
#     """
#     if percent == 100.0 or percent == 0.0:
#         eta = 0
#     else:
#         eta = timedelta / percent * (100.0 - percent)
# 
#     print "%05.2f %% done in %s; ETA : %s" % (percent,
#                                               format_time(timedelta),
#                                               format_time(eta))


# Path: sesql/management/commands/sesqlfixatedate.py
import sys
import time
from optparse import make_option
from django.db import transaction
from django.core.management.base import BaseCommand
from sesql import config
from sesql import typemap
from sesql.utils import print_eta

                    help='Delay between two steps (default: 0.1 s) '),
        make_option('--source',
                    dest='source',
                    default=None,
                    help='Name of the source field'),
        make_option('--target',
                    dest='target',
                    default=None,
                    help='Name of the target field'),
        )

    @transaction.commit_on_success
    def iteration(self, table, idmin, idmax):
        """
        Perform one iteration : reindex everything
        """
        cursor = config.orm.cursor()
        query = '''
        UPDATE %s
        SET %s = %s
        WHERE %s IS NULL
        AND (id >= %d) AND (id <= %d)
        ''' % (table, self.target, self.source, self.target, idmin, idmax)
        cursor.execute(query)

    def process_table(self, table):
        """
        Process on given table
        """


        cursor = config.orm.cursor()