← Back to team overview

pbxt-discuss team mailing list archive

Re: free_table_share() != drizzle

 

Hi!

On May 17, 2010, at 4:21 AM, Paul McCullagh wrote:

> Are you suggesting I create a TableShare on the stack whenever I need it?
> I don't think this would work because AFAIK I have to call open_table_def(), which loads the table definition. So calling this each time I want to copy data in and out of the row would be too slow.
> 
> What may work is to use a TableShare object instead of a Table object.

That is what I was suggesting, just create an object and use it.

> Question is, can I do something like:
> share = new TableShare();
> share->init(db_name, 0, name, path);
> error = open_table_def(&thd, *ident, share);

Yes you can do this, hell, we can probably make it simpler then this as well.

> and then later simply:
> delete share;
> to remove.

Yep. If you look in createTable() you can even see how we do this during that operation.

Cheers,
	-Brian

> 
> On May 14, 2010, at 9:03 PM, Brian Aker wrote:
> 
>> Hi!
>> 
>> On May 14, 2010, at 9:37 AM, Paul McCullagh wrote:
>> 
>>> Here the engine will follow the "table" pointer to the "field" array, where it uses the offsets of the data in a record, in order to copy data in and out of the record.
>> 
>> So what you need is the Field** that is in share (aka, you don't even need Table, you just need TableShare).
>> 
>> You could just do this:
>> 
>> TableShare my_share(<share_key>,....);
>> 
>> That way you have your own object and you never pass through any of the locking system/dealing with any of the object counting.
>> 
>> Cheers,
>> 	-Brian
>> 
> 
> 
> 
> --
> Paul McCullagh
> PrimeBase Technologies
> www.primebase.org
> www.blobstreaming.org
> pbxt.blogspot.com
> 
> 
> 




Follow ups

References