YoushouldhavereceivedacopyoftheGNUGeneralPublicLicense alongwiththisprogram;ifnot,writetotheFreeSoftware
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
DBUG_PRINT("info", ("tid %llu is not mapped!", table_id));
DBUG_RETURN(NULL);
}
/* Calledwhenweareoutoftableidentries.CreatesTABLE_ID_CHUNK newentries,chainthemandattachthemattheheadofthelistoffree (freeforuse)entries.
*/ int table_mapping::expand()
{ /* Ifwewantedtouse"tmp=new(&m_mem_root)entry[TABLE_ID_CHUNK]", wewouldhavetomake"entry"derivefromSql_allocbutthenitwouldnot beaPODanymoreandwewantittobe(seerpl_tblmap.h).Soweallocate inC.
*/
entry *tmp= (entry *)alloc_root(&m_mem_root, TABLE_ID_CHUNK*sizeof(entry)); if (tmp == NULL) return ERR_MEMORY_ALLOCATION; // Memory allocation failed
/* Find the end of this fresh new array of free entries */
entry *e_end= tmp+TABLE_ID_CHUNK-1; for (entry *e= tmp; e < e_end; e++)
e->next= e+1;
e_end->next= m_free;
m_free= tmp; return0;
}
int table_mapping::set_table(ulonglong table_id, TABLE* table)
{
DBUG_ENTER("table_mapping::set_table(ulong,TABLE*)");
DBUG_PRINT("enter", ("table_id: %llu table: %p (%s)",
table_id,
table, MAYBE_TABLE_NAME(table)));
entry *e= find_entry(table_id); if (e == 0)
{ if (m_free == 0 && expand())
DBUG_RETURN(ERR_MEMORY_ALLOCATION); // Memory allocation failed
e= m_free;
m_free= m_free->next;
} else
{ #ifdef MYSQL_CLIENT
free_table_map_log_event(e->table); #endif
my_hash_delete(&m_table_ids,(uchar *)e);
}
e->table_id= table_id;
e->table= table; if (my_hash_insert(&m_table_ids,(uchar *)e))
{ /* we add this entry to the chain of free (free for use) entries */
e->next= m_free;
m_free= e;
DBUG_RETURN(ERR_MEMORY_ALLOCATION);
}
DBUG_PRINT("info", ("tid %llu -> table %p (%s)",
table_id, e->table,
MAYBE_TABLE_NAME(e->table)));
DBUG_RETURN(0); // All OK
}
int table_mapping::remove_table(ulonglong table_id)
{
entry *e= find_entry(table_id); if (e)
{
my_hash_delete(&m_table_ids,(uchar *)e); /* we add this entry to the chain of free (free for use) entries */
e->next= m_free;
m_free= e; return0; // All OK
} return1; // No table to remove
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.