美文网首页
mysql 存储过程 查询 wordpress multi模式下

mysql 存储过程 查询 wordpress multi模式下

作者: xiongyi | 来源:发表于2019-08-21 17:24 被阅读0次

    drop PROCEDURE if exists find_options;

    create procedure find_options()

    BEGIN

    DECLARE done int DEFAULT 0;

    declare blogid int;

    declare cur cursor for select blog_id from sitebuilt_blog.wp_blogs b;

    declare CONTINUE HANDLER for SQLSTATE '02000' set done = 1;

    open cur;

    REPEAT

        fetch cur into blogid;

        if not done THEN

                set @blogid=blogid;

                if not EXISTS (select table_name from information_schema.tables where table_schema = 'sitebuilt_blog' and table_name = CONCAT('wp_',@blogid,'_options') limit 1)

                THEN

                    select @blogid;

                end if;

        end if;

    UNTIL done END REPEAT;

    close cur;

    end;

    call find_options();

    相关文章

      网友评论

          本文标题:mysql 存储过程 查询 wordpress multi模式下

          本文链接:https://www.haomeiwen.com/subject/azuisctx.html