Purpose
Adds a new row to a table.
Synopsis
virtual int write_row
( |
buf) ; |
|
Description
This is the write_row
method.
write_row()
inserts a row. No
extra()
hint is given currently if a bulk load is happening. buf is a
byte array of data with a size of table->s->reclength
You can use the field information to extract the data from the
native byte array type. Example of this would be: for (Field
**field=table->field ; *field ; field++) { ... }
BLOBs must be handled specially:
for (ptr= table->s->blob_field, end= ptr + table->s->blob_fields ; ptr != end ; ptr++)
{
char *data_ptr;
uint32 size= ((Field_blob*)table->field[*ptr])->get_length();
((Field_blob*)table->field[*ptr])->get_ptr(&data_ptr);
...
}
See ha_tina.cc for an example of extracting all of the data as
strings. ha_berkeley.cc has an example of how to store it intact
by "packing" it for ha_berkeley's own native storage type.
See the note for update_row()
on
auto_increments and timestamps. This case also applied to
write_row().
Called from item_sum.cc, item_sum.cc, sql_acl.cc, sql_insert.cc,
sql_insert.cc, sql_select.cc, sql_table.cc, sql_udf.cc, and
sql_update.cc.
Parameters
Return Values
There are no return values.
Usage
Default Implementation
{ return HA_ERR_WRONG_COMMAND; }