Exemplo n.º 1
0
    def get_bulk_insert_table_columns_info(self):
        """
        Gets the column names and column types of the current table for bulk insert.
        """
        query = """
select 1 from
information_schema.TABLES
where TABLE_SCHEMA = database()
and   TABLE_NAME   = '%s'""" % self._table_name

        table_is_non_temporary = StaticDataLayer.execute_rows(query)

        if len(table_is_non_temporary) == 0:
            query = 'call %s()' % self._routine_name
            StaticDataLayer.execute_sp_none(query)

        query = "describe `%s`" % self._table_name
        columns = StaticDataLayer.execute_rows(query)

        tmp_column_types = []
        tmp_fields = []

        n1 = 0
        for column in columns:
            p = re.compile('(\\w+)')
            c_type = p.findall(column['Type'])
            tmp_column_types.append(c_type[0])
            tmp_fields.append(column['Field'])
            n1 += 1

        n2 = len(self._columns)

        if len(table_is_non_temporary) == 0:
            query = "drop temporary table `%s`" % self._table_name
            StaticDataLayer.execute_none(query)

        if n1 != n2:
            raise Exception(
                "Number of fields %d and number of columns %d don't match." %
                (n1, n2))

        self._columns_types = tmp_column_types
        self._fields = tmp_fields
Exemplo n.º 2
0
 def tst_parameter_types01(p_param00, p_param01, p_param02, p_param03,
                           p_param04, p_param05, p_param06, p_param07,
                           p_param08, p_param09, p_param10, p_param11,
                           p_param12, p_param13, p_param14, p_param15,
                           p_param16, p_param17, p_param26, p_param27):
     return StaticDataLayer.execute_sp_none(
         "call tst_parameter_types01(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
         p_param00, p_param01, p_param02, p_param03, p_param04, p_param05,
         p_param06, p_param07, p_param08, p_param09, p_param10, p_param11,
         p_param12, p_param13, p_param14, p_param15, p_param16, p_param17,
         p_param26, p_param27)
    def get_bulk_insert_table_columns_info(self):
        """
        Gets the column names and column types of the current table for bulk insert.
        """
        query = """
select 1 from
information_schema.TABLES
where TABLE_SCHEMA = database()
and   TABLE_NAME   = '%s'""" % self._table_name

        table_is_non_temporary = StaticDataLayer.execute_rows(query)

        if len(table_is_non_temporary) == 0:
            query = 'call %s()' % self._routine_name
            StaticDataLayer.execute_sp_none(query)

        query = "describe `%s`" % self._table_name
        columns = StaticDataLayer.execute_rows(query)

        tmp_column_types = []
        tmp_fields = []

        n1 = 0
        for column in columns:
            p = re.compile('(\\w+)')
            c_type = p.findall(column['Type'])
            tmp_column_types.append(c_type[0])
            tmp_fields.append(column['Field'])
            n1 += 1

        n2 = len(self._columns)

        if len(table_is_non_temporary) == 0:
            query = "drop temporary table `%s`" % self._table_name
            StaticDataLayer.execute_none(query)

        if n1 != n2:
            raise Exception("Number of fields %d and number of columns %d don't match." % (n1, n2))

        self._columns_types = tmp_column_types
        self._fields = tmp_fields
Exemplo n.º 4
0
 def tst_test_none_with_lob(p_count, p_blob):
     return StaticDataLayer.execute_sp_none(
         "call tst_test_none_with_lob(%s, %s)", p_count, p_blob)
Exemplo n.º 5
0
 def tst_test_none(p_count):
     return StaticDataLayer.execute_sp_none("call tst_test_none(%s)",
                                            p_count)