| 834 | */ |
| 835 | |
| 836 | int sequence_definition::write_initial_sequence(TABLE *table) |
| 837 | { |
| 838 | int error; |
| 839 | MY_BITMAP *save_write_set; |
| 840 | |
| 841 | store_fields(table); |
| 842 | /* Store the sequence values in table share */ |
| 843 | table->s->sequence->copy(this); |
| 844 | /* |
| 845 | Sequence values will be replicated as a statement |
| 846 | like 'create sequence'. So disable row logging for this table & statement |
| 847 | */ |
| 848 | table->file->row_logging= table->file->row_logging_init= 0; |
| 849 | save_write_set= table->write_set; |
| 850 | table->write_set= &table->s->all_set; |
| 851 | table->s->sequence->initialized= SEQUENCE::SEQ_IN_PREPARE; |
| 852 | error= table->file->ha_write_row(table->record[0]); |
| 853 | table->s->sequence->initialized= SEQUENCE::SEQ_UNINTIALIZED; |
| 854 | table->write_set= save_write_set; |
| 855 | if (unlikely(error)) |
| 856 | table->file->print_error(error, MYF(0)); |
| 857 | else |
| 858 | { |
| 859 | /* |
| 860 | Sequence structure is up to date and table has one row, |
| 861 | sequence is now usable |
| 862 | */ |
| 863 | table->s->sequence->initialized= SEQUENCE::SEQ_READY_TO_USE; |
| 864 | } |
| 865 | return error; |
| 866 | } |
| 867 | |
| 868 | |
| 869 | /** |
no test coverage detected