~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/heap/hp_open.cc

Merge of Keycache gutting code. (this is a test).

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
/* open a heap-database */
17
17
 
31
31
 
32
32
HP_INFO *heap_open_from_share(HP_SHARE *share, int mode)
33
33
{
34
 
  HP_INFO *info= new HP_INFO;
 
34
  HP_INFO *info;
35
35
 
 
36
  if (!(info= (HP_INFO*) malloc(sizeof(HP_INFO) + 2 * share->max_key_length)))
 
37
  {
 
38
    return(0);
 
39
  }
 
40
  memset(info, 0, sizeof(HP_INFO) + 2 * share->max_key_length);
36
41
  share->open_count++;
37
 
  info->setShare(share);
38
 
  info->lastkey.resize(share->max_key_length);
 
42
  info->lock.init(&share->lock);
 
43
  info->s= share;
 
44
  info->lastkey= (unsigned char*) (info + 1);
 
45
  info->recbuf= (unsigned char*) (info->lastkey + share->max_key_length);
39
46
  info->mode= mode;
40
47
  info->current_record= UINT32_MAX;             /* No current record */
41
48
  info->lastinx= info->errkey= -1;
42
 
  return info;
 
49
  return(info);
43
50
}
44
51
 
45
52
 
97
104
  list<HP_SHARE *>::iterator it= heap_share_list.begin();
98
105
  while (it != heap_share_list.end())
99
106
  {
100
 
    if (not (*it)->name.compare(name))
 
107
    if (!strcmp(name, (*it)->name))
101
108
    {
102
109
      return (*it);
103
110
    }