Documentation Home
MySQL Internals Manual


23.18.27 write_row

Purpose

Adds a new row to a table.

Synopsis

virtual int write_row (

buf);

byte *

buf ;

Description

This is the write_row method.

write_row() inserts a row. No [custom-engine.html#custom-engine-api-reference-extra 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.

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

  • buf byte array of data

Return Values

There are no return values.

Usage

This section is still to be written.

Default Implementation

 { return HA_ERR_WRONG_COMMAND; }

User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
Sign Up Login You must be logged in to post a comment.