List:Internals« Previous MessageNext Message »
From:Michael Widenius Date:August 17 2008 6:42pm
Subject:Re: About evaluation of expressions
View as plain text  
Hi!

>>>>> "Nihal" == Nihal Dindar <dindarn@stripped> writes:

Nihal> Hi,
Nihal> Thank you very much for your response. But, unfortunately I couldn't 
Nihal> make it run. I used the offset() method of the field class in order to 
Nihal> get memory offset information of a field. But the offset is same for 
Nihal> each record. For example, in a table which has fields A, B, C. Offset 
Nihal> information of fields are 1, 22, 26 for each row. (when I send 
table-> record[0] as argument to offset method )

Yes, field->offset is calculated when table is opened and is never
changed.

Here is how the val_int_offset() function is declared:

inline longlong val_int_offset(uint row_offset)
{
  ptr+=row_offset;
  longlong tmp=val_int();
  ptr-=row_offset;
  return tmp;
}

You can use the same hack to address a field that is stored anywhere.

Nihal> I also tried to copy the record information 
Nihal> (join_tab->read_record.record) with memcpy to somewhere, but in this 
Nihal> case I needed the length of the record, so I used the 
Nihal> join_tab->read_record.reclength information, which returns 0. I also 
Nihal> tried to used  join_tab->table->s->rec_buff_length for length of the 
Nihal> record. It doesn't work either.

Why use join_tab->read_record?
This is a method for scaning rows (with or without an internal cache)
and shouldn't be used for accessing new/old values of rows.
(Especially as there is no guaranteed that this method is always used to
read rows)

The record data is normally in table->record_buffer[]. The length of this
buffer is table->reclength.

Nihal> Do you have any further suggestions?

To be able to help you we would need more information at which place
in the code you need access to the data for an old/new record.

Regards,
Monty
Thread
About evaluation of expressionsNihal Dindar15 Aug
Re: About evaluation of expressionsMichael Widenius17 Aug
Re: About evaluation of expressionsMichael Widenius21 Aug