ó n[Qc @sÖddlZddlZddlZddlmZmZddlmZddlm Z ddlm Z e ej j ej dƒddeƒZejd d d d d ddeddƒd„Zejddd dddjeƒdddjeeeƒƒƒeeƒejdddd dd ddeddƒejddd d dd!ƒejd"d d#dddd$ƒe ed%d&ƒejƒ\ZZd'Zd(Zd)ZejsÁejd*ƒnejrejdk r5e ejƒdkr5ejeƒq5n4ejdks%e ejƒdkr5ejeƒnej!d+ej"ƒZ"eejej#e"ej$ej%ƒZ&y4ejrˆe&j'ƒGHne&j(ejd,ej)ƒWn&e*k rÊZ+ej,d-Ie+IJnXe-ƒdS(.iÿÿÿÿN(t ObjectGrept OBJECT_TYPES(t add_regexp(tsetup_common_options(tadd_format_optionismysqlmetagrep - search metadatas;%prog --server=user:pass@host:port:socket [options] patterns-bs--bodytdestt check_bodytactiont store_truetdefaultthelps9search the body of routines, triggers, and events as wellcCs d|dS(Nt'((tstring((s%..\utilities\scripts\mysqlmetagrep.pytquote'ss--search-objectss--object-typest object_typest,sHthe object type to search in: a comma-separated list of one or more of: s, s-ps --print-sqls--sqlt print_sqls7print the statement instead of sending it to the servers-es --patterntpatterns\pattern to use when matching. Required if the pattern looks like a connection specification.s --databasetdatabase_patterns7only look at objects in databases matching this patternsIdisplay the output in either grid (default), tab, csv, or vertical formattgridshPattern '{pattern}' looks like a connection specification. Use --pattern if this is really what you wantsAYou need at least one server if you're not using the --sql optionsLYou should not include servers in the call if you are using the --sql optionsNo pattern supplied.s\s*,\s*tformatsERROR:(.tos.pathtostretsystmysql.utilities.command.grepRRtmysql.utilities.common.optionsRRRtpathtbasenametargvtTruetparsert add_optiontFalseR tjointmaptNonet parse_argstoptionstargst_LOOKS_LIKE_CONNECTION_MSGt_AT_LEAST_ONE_SERVER_MSGt_NO_SERVERS_ALLOWED_MSGRterrorRtservertlentsplitRRRt use_regexptcommandtsqltexecuteRt Exceptiontdetailststderrtexit(((s%..\utilities\scripts\mysqlmetagrep.pytsn             $$