~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_yacc.yy

  • Committer: Stewart Smith
  • Date: 2010-02-15 01:56:32 UTC
  • mto: (1273.13.96 build)
  • mto: This revision was merged to the branch mainline in revision 1308.
  • Revision ID: stewart@flamingspork.com-20100215015632-pm7lnxfq5j5uh8kj
move DATABASE() to function plugin. modify parser so that it looks for a function named 'database' when DATABASE() is called. Special case still needed in parser due to hilarity of not-really-reserved words.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3111
3111
          { $$= new (YYSession->mem_root) Item_func_collation($3); }
3112
3112
        | DATABASE '(' ')'
3113
3113
          {
3114
 
            $$= new (YYSession->mem_root) Item_func_database();
 
3114
            std::string database_str("database");
 
3115
            const plugin::Function *udf= plugin::Function::get(database_str.c_str(), database_str.length());
 
3116
            Session *session= YYSession;
 
3117
            Item *item= NULL;
 
3118
 
 
3119
            if (udf)
 
3120
            {
 
3121
              item= Create_udf_func::s_singleton.create(session, udf, NULL);
 
3122
            } else {
 
3123
              my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", database_str.c_str());
 
3124
            }
 
3125
 
 
3126
            if (! ($$= item))
 
3127
            {
 
3128
              DRIZZLE_YYABORT;
 
3129
            }
3115
3130
          }
3116
3131
        | IF '(' expr ',' expr ',' expr ')'
3117
3132
          { $$= new (YYSession->mem_root) Item_func_if($3,$5,$7); }