[MDEV-9170] Get rid of LEX::length and LEX::dec Created: 2015-11-23  Updated: 2016-01-11  Resolved: 2015-11-23

Status: Closed
Project: MariaDB Server
Component/s: Parser
Fix Version/s: 10.2.0

Type: Task Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: duplicate-code

Issue Links:
Blocks
blocks MDEV-4912 Data type plugin API version 1 Closed
Sprint: 10.2.0-1

 Description   

Passing data in sql_yacc.yy through LEX members is hard to follow and is not recursively safe.
We'll get rid of LEX::length and LEX::dec and add a structure instead:

struct Lex_length_and_dec_st
{
  const char *length;
  const char *dec;
};

so it can be passed through the syntax rules in sql_yacc.yy as $$, $1, $2, etc.
This will help, for example, to change:

field_spec:
  field_ident { /* new Create_field is allocated here */}
  field_type { Lex->set_last_field_type($3); }
  field_def { ... }
  ;

into:

field_spec:
  field_ident field_type { /* new Create field is allocated here*/ }
  field_def { ... }

So we'll already know data type, length and dec when we do "new Create_field".
This will allow to call a method in Type_handler, to create a data-type specific "Create_field" replacement, instead of using the generic universal Create_field.


Generated at Thu Feb 08 07:32:39 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.