Files
percona-toolkit/docs/dev/html/files/modules/ChangeHandler-pm.html

85 lines
43 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>ChangeHandler</title><link rel="stylesheet" type="text/css" href="../../styles/main.css"><script language=JavaScript src="../../javascript/main.js"></script><script language=JavaScript src="../../javascript/prettify.js"></script><script language=JavaScript src="../../javascript/searchdata.js"></script></head><body class="ContentPage" onLoad="NDOnLoad();prettyPrint();"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>
<!-- Generated by Natural Docs, version 1.52 -->
<!-- http://www.naturaldocs.org -->
<!-- saved from url=(0026)http://www.naturaldocs.org -->
<div id=Content><div class="CClass"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="ChangeHandler"></a>ChangeHandler</h1><div class=CBody><p>ChangeHandler creates SQL statements for changing rows in a table.</p><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SMain"><td class=SEntry><a href="#ChangeHandler" >ChangeHandler</a></td><td class=SDescription>ChangeHandler creates SQL statements for changing rows in a table.</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#ChangeHandler.Variables" >Variables</a></td><td class=SDescription></td></tr><tr class="SVariable SIndent2 SMarked"><td class=SEntry><a href="#ChangeHandler.$DUPE_KEY" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">$DUPE_KEY</a></td><td class=SDescription></td></tr><tr class="SVariable SIndent2"><td class=SEntry><a href="#ChangeHandler.@ACTIONS" id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')">@ACTIONS</a></td><td class=SDescription></td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#ChangeHandler.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#ChangeHandler.new" id=link3 onMouseOver="ShowTip(event, 'tt3', 'link3')" onMouseOut="HideTip('tt3')">new</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#ChangeHandler.fetch_back" id=link4 onMouseOver="ShowTip(event, 'tt4', 'link4')" onMouseOut="HideTip('tt4')">fetch_back</a></td><td class=SDescription>Set the fetch-back dbh. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#ChangeHandler.set_src" id=link5 onMouseOver="ShowTip(event, 'tt5', 'link5')" onMouseOut="HideTip('tt5')">set_src</a></td><td class=SDescription>Set which side of left-right pair is the source. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#ChangeHandler.src" id=link6 onMouseOver="ShowTip(event, 'tt6', 'link6')" onMouseOut="HideTip('tt6')">src</a></td><td class=SDescription>Return current source db.tbl (could be left or right table).</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#ChangeHandler.dst" id=link7 onMouseOver="ShowTip(event, 'tt7', 'link7')" onMouseOut="HideTip('tt7')">dst</a></td><td class=SDescription>Return current destination db.tbl (could be left or right table).</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#ChangeHandler._take_action" id=link8 onMouseOver="ShowTip(event, 'tt8', 'link8')" onMouseOut="HideTip('tt8')">_take_action</a></td><td class=SDescription>Call the user-provied actions. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#ChangeHandler.change" id=link9 onMouseOver="ShowTip(event, 'tt9', 'link9')" onMouseOut="HideTip('tt9')">change</a></td><td class=SDescription>Make an action SQL statment for the given parameters if not queueing. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#ChangeHandler.__queue" id=link10 onMouseOver="ShowTip(event, 'tt10', 'link10')" onMouseOut="HideTip('tt10')">__queue</a></td><td class=SDescription>Queue an action for later execution. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#ChangeHandler.process_rows" id=link11 onMouseOver="ShowTip(event, 'tt11', 'link11')" onMouseOut="HideTip('tt11')">process_rows</a></td><td class=SDescription>Make changes to rows created/queued earlier. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#ChangeHandler.make_DELETE" id=link12 onMouseOver="ShowTip(event, 'tt12', 'link12')" onMouseOut="HideTip('tt12')">make_DELETE</a></td><td class=SDescription>Make a DELETE statement. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#ChangeHandler.make_UPDATE" id=link13 onMouseOver="ShowTip(event, 'tt13', 'link13')" onMouseOut="HideTip('tt13')">make_UPDATE</a></td><td class=SDescription>Make an UPDATE statement.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#ChangeHandler.make_INSERT" id=link14 onMouseOver="ShowTip(event, 'tt14', 'link14')" onMouseOut="HideTip('tt14')">make_INSERT</a></td><td class=SDescription>Make an INSERT statement. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#ChangeHandler.make_REPLACE" id=link15 onMouseOver="ShowTip(event, 'tt15', 'link15')" onMouseOut="HideTip('tt15')">make_REPLACE</a></td><td class=SDescription>Make a REPLACE statement. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#ChangeHandler.make_row" id=link16 onMouseOver="ShowTip(event, 'tt16', 'link16')" onMouseOut="HideTip('tt16')">make_row</a></td><td class=SDescription>Make an INSERT or REPLACE statement. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#ChangeHandler.make_where_clause" id=link17 onMouseOver="ShowTip(event, 'tt17', 'link17')" onMouseOut="HideTip('tt17')">make_where_clause</a></td><td class=SDescription>Make a WHERE clause. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#ChangeHandler.get_changes" id=link18 onMouseOver="ShowTip(event, 'tt18', 'link18')" onMouseOut="HideTip('tt18')">get_changes</a></td><td class=SDescription>Get a summary of changes made.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#ChangeHandler.sort_cols" id=link19 onMouseOver="ShowTip(event, 'tt19', 'link19')" onMouseOut="HideTip('tt19')">sort_cols</a></td><td class=SDescription>Sort a row&rsquo;s columns based on their real order in the table. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#ChangeHandler.make_fetch_back_query" id=link20 onMouseOver="ShowTip(event, 'tt20', 'link20')" onMouseOut="HideTip('tt20')">make_fetch_back_query</a></td><td class=SDescription>Make a SELECT statement to fetch-back values. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#ChangeHandler._d" id=link21 onMouseOver="ShowTip(event, 'tt21', 'link21')" onMouseOut="HideTip('tt21')">_d</a></td><td class=SDescription></td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>
<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="ChangeHandler.Variables"></a>Variables</h3></div></div>
<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="ChangeHandler.$DUPE_KEY"></a>$DUPE_KEY</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">my $DUPE_KEY</td></tr></table></blockquote></div></div></div>
<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="ChangeHandler.@ACTIONS"></a>@ACTIONS</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">our @ACTIONS</td></tr></table></blockquote></div></div></div>
<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="ChangeHandler.Functions"></a>Functions</h3></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="ChangeHandler.new"></a>new</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub new</td></tr></table></blockquote><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>%args</td><td class=CDLDescription>Arguments</td></tr></table><h4 class=CHeading>Required Arguments</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>left_db</td><td class=CDLDescription>Left database (src by default)</td></tr><tr><td class=CDLEntry>left_tbl</td><td class=CDLDescription>Left table (src by default)</td></tr><tr><td class=CDLEntry>right_db</td><td class=CDLDescription>Right database (dst by default)</td></tr><tr><td class=CDLEntry>right_tbl</td><td class=CDLDescription>Right table (dst by default)</td></tr><tr><td class=CDLEntry>actions</td><td class=CDLDescription>arrayref of subroutines to call when handling a change.</td></tr><tr><td class=CDLEntry>replace</td><td class=CDLDescription>Do UPDATE/INSERT as REPLACE.</td></tr><tr><td class=CDLEntry>queue</td><td class=CDLDescription>Queue changes until <a href="#ChangeHandler.process_rows" class=LFunction id=link22 onMouseOver="ShowTip(event, 'tt11', 'link22')" onMouseOut="HideTip('tt11')">process_rows()</a> is called with a greater queue level.</td></tr><tr><td class=CDLEntry>Quoter</td><td class=CDLDescription><a href="Quoter-pm.html#Quoter" class=LClass id=link23 onMouseOver="ShowTip(event, 'tt22', 'link23')" onMouseOut="HideTip('tt22')">Quoter</a> object</td></tr></table><h4 class=CHeading>Optional Arguments</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>tbl_struct</td><td class=CDLDescription>Used to sort columns and detect binary columns</td></tr><tr><td class=CDLEntry>hex_blob</td><td class=CDLDescription>HEX() BLOB columns (default yes)</td></tr></table><h4 class=CHeading>Returns</h4><p>ChangeHandler object</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="ChangeHandler.fetch_back"></a>fetch_back</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub fetch_back</td></tr></table></blockquote><p>Set the fetch-back dbh.&nbsp; If I&rsquo;m supposed to fetch-back, that means I have to get the full row from the database.&nbsp; For example, someone might call me like so: $me-&gt;change(&lsquo;UPDATE&rsquo;, { a =&gt; 1 }) But &lsquo;a&rsquo; is only the primary key.&nbsp; I now need to select that row and make an UPDATE statement with all of its columns.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>$dbh</td><td class=CDLDescription>dbh to use for fetching-back values</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="ChangeHandler.set_src"></a>set_src</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub set_src</td></tr></table></blockquote><p>Set which side of left-right pair is the source.&nbsp; For bidirectional syncing both tables are src and dst.&nbsp; Internally, we refer to the tables generically as the left and right.&nbsp; Either one can be src or dst, as set by this sub when called by the caller.&nbsp; Other subs don&rsquo;t know to which table src or dst point.&nbsp; They just fetchback from src and change dst.&nbsp; If the optional $dbh arg is given, fetch_back() is set with it, too.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>$src</td><td class=CDLDescription>Hashref with source host information</td></tr><tr><td class=CDLEntry>$dbh</td><td class=CDLDescription>Set <a href="#ChangeHandler.fetch_back" class=LFunction id=link24 onMouseOver="ShowTip(event, 'tt4', 'link24')" onMouseOut="HideTip('tt4')">fetch_back()</a> with this dbh if given</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="ChangeHandler.src"></a>src</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub src</td></tr></table></blockquote><p>Return current source db.tbl (could be left or right table).</p><h4 class=CHeading>Returns</h4><p>Source database-qualified table name</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="ChangeHandler.dst"></a>dst</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub dst</td></tr></table></blockquote><p>Return current destination db.tbl (could be left or right table).</p><h4 class=CHeading>Returns</h4><p>Destination database-qualified table name</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="ChangeHandler._take_action"></a>_take_action</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub _take_action</td></tr></table></blockquote><p>Call the user-provied actions.&nbsp; Actions are passed an action statement and an optional dbh.&nbsp; This sub is not called directly; it&rsquo;s called by <a href="#ChangeHandler.change" class=LFunction id=link25 onMouseOver="ShowTip(event, 'tt9', 'link25')" onMouseOut="HideTip('tt9')">change()</a> or <a href="#ChangeHandler.process_rows" class=LFunction id=link26 onMouseOver="ShowTip(event, 'tt11', 'link26')" onMouseOut="HideTip('tt11')">process_rows()</a>.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>sql</td><td class=CDLDescription>A SQL statement</td></tr><tr><td class=CDLEntry>dbh</td><td class=CDLDescription>optional dbh passed to the action callback</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="ChangeHandler.change"></a>change</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub change</td></tr></table></blockquote><p>Make an action SQL statment for the given parameters if not queueing.&nbsp; This sub calls <a href="#ChangeHandler._take_action" class=LFunction id=link27 onMouseOver="ShowTip(event, 'tt8', 'link27')" onMouseOut="HideTip('tt8')">_take_action()</a>, passing the action statement and optional dbh.&nbsp; If queueing, the parameters are saved and the same work is done in <a href="#ChangeHandler.process_rows" class=LFunction id=link28 onMouseOver="ShowTip(event, 'tt11', 'link28')" onMouseOut="HideTip('tt11')">process_rows()</a>.&nbsp; Queueing does not work with bidirectional syncs.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>action</td><td class=CDLDescription>One of @ACTIONS</td></tr><tr><td class=CDLEntry>row</td><td class=CDLDescription>Hashref of row data</td></tr><tr><td class=CDLEntry>cols</td><td class=CDLDescription>Arrayref of column names</td></tr><tr><td class=CDLEntry>dbh</td><td class=CDLDescription>Optional dbh passed to <a href="#ChangeHandler._take_action" class=LFunction id=link29 onMouseOver="ShowTip(event, 'tt8', 'link29')" onMouseOut="HideTip('tt8')">_take_action()</a></td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="ChangeHandler.__queue"></a>__queue</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub __queue</td></tr></table></blockquote><p>Queue an action for later execution.&nbsp; This sub is called by <a href="#ChangeHandler.change" class=LFunction id=link30 onMouseOver="ShowTip(event, 'tt9', 'link30')" onMouseOut="HideTip('tt9')">change()</a> <a href="#ChangeHandler.process_rows" class=LFunction id=link31 onMouseOver="ShowTip(event, 'tt11', 'link31')" onMouseOut="HideTip('tt11')">process_rows()</a> to defer action.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>action</td><td class=CDLDescription>One of @ACTIONS</td></tr><tr><td class=CDLEntry>row</td><td class=CDLDescription>Hashref of row data</td></tr><tr><td class=CDLEntry>cols</td><td class=CDLDescription>Arrayref of column names</td></tr><tr><td class=CDLEntry>dbh</td><td class=CDLDescription>Optional dbh passed to <a href="#ChangeHandler._take_action" class=LFunction id=link32 onMouseOver="ShowTip(event, 'tt8', 'link32')" onMouseOut="HideTip('tt8')">_take_action()</a></td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="ChangeHandler.process_rows"></a>process_rows</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub process_rows</td></tr></table></blockquote><p>Make changes to rows created/queued earlier.&nbsp; If called with 1, will process rows that have been deferred from instant processing.&nbsp; If no arg, will process all rows.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>$queue_level</td><td class=CDLDescription>Queue level caller is in</td></tr><tr><td class=CDLEntry>$trace_msg</td><td class=CDLDescription>Optional string to append to each SQL statement for tracing them in binary logs.</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="ChangeHandler.make_DELETE"></a>make_DELETE</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub make_DELETE</td></tr></table></blockquote><p>Make a DELETE statement.&nbsp; DELETE never needs to be fetched back.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>$row</td><td class=CDLDescription>Hashref with row values</td></tr><tr><td class=CDLEntry>$cols</td><td class=CDLDescription>Arrayref with column names</td></tr></table><h4 class=CHeading>Returns</h4><p>A DELETE statement for the given row and columns</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="ChangeHandler.make_UPDATE"></a>make_UPDATE</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub make_UPDATE</td></tr></table></blockquote><p>Make an UPDATE statement.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>$row</td><td class=CDLDescription>Hashref with row values</td></tr><tr><td class=CDLEntry>$cols</td><td class=CDLDescription>Arrayref with column names</td></tr></table><h4 class=CHeading>Returns</h4><p>An UPDATE statement for the given row and columns</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="ChangeHandler.make_INSERT"></a>make_INSERT</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub make_INSERT</td></tr></table></blockquote><p>Make an INSERT statement.&nbsp; This sub is stub for <a href="#ChangeHandler.make_row" class=LFunction id=link33 onMouseOver="ShowTip(event, 'tt16', 'link33')" onMouseOut="HideTip('tt16')">make_row()</a> which does the real work.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>$row</td><td class=CDLDescription>Hashref with row values</td></tr><tr><td class=CDLEntry>$cols</td><td class=CDLDescription>Arrayref with column names</td></tr></table><h4 class=CHeading>Returns</h4><p>An INSERT statement for the given row and columns</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="ChangeHandler.make_REPLACE"></a>make_REPLACE</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub make_REPLACE</td></tr></table></blockquote><p>Make a REPLACE statement.&nbsp; This sub is a stub for <a href="#ChangeHandler.make_row" class=LFunction id=link34 onMouseOver="ShowTip(event, 'tt16', 'link34')" onMouseOut="HideTip('tt16')">make_row()</a> which does the real work.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>$row</td><td class=CDLDescription>Hashref with row values</td></tr><tr><td class=CDLEntry>$cols</td><td class=CDLDescription>Arrayref with column names</td></tr></table><h4 class=CHeading>Returns</h4><p>A REPLACE statement for the given row and columns</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="ChangeHandler.make_row"></a>make_row</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub make_row</td></tr></table></blockquote><p>Make an INSERT or REPLACE statement.&nbsp; Values from $row are quoted with <a href="Quoter-pm.html#Quoter.quote_val" class=LFunction id=link35 onMouseOver="ShowTip(event, 'tt23', 'link35')" onMouseOut="HideTip('tt23')">Quoter::quote_val()</a>.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>$verb</td><td class=CDLDescription>&rdquo;INSERT&rdquo; or &ldquo;REPLACE&rdquo;</td></tr><tr><td class=CDLEntry>$row</td><td class=CDLDescription>Hashref with row values</td></tr><tr><td class=CDLEntry>$cols</td><td class=CDLDescription>Arrayref with column names</td></tr></table><h4 class=CHeading>Returns</h4><p>A SQL statement</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="ChangeHandler.make_where_clause"></a>make_where_clause</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub make_where_clause</td></tr></table></blockquote><p>Make a WHERE clause.&nbsp; Values are quoted with <a href="Quoter-pm.html#Quoter.quote_val" class=LFunction id=link36 onMouseOver="ShowTip(event, 'tt23', 'link36')" onMouseOut="HideTip('tt23')">Quoter::quote_val()</a>.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>$row</td><td class=CDLDescription>Hashref with row values</td></tr><tr><td class=CDLEntry>$cols</td><td class=CDLDescription>Arrayref with column names</td></tr></table><h4 class=CHeading>Returns</h4><p>A WHERE clause without the word &ldquo;WHERE&rdquo;</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="ChangeHandler.get_changes"></a>get_changes</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub get_changes</td></tr></table></blockquote><p>Get a summary of changes made.</p><h4 class=CHeading>Returns</h4><p>Hash of changes where the keys are actions like &ldquo;DELETE&rdquo; and the values are how many of the action were made</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="ChangeHandler.sort_cols"></a>sort_cols</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub sort_cols</td></tr></table></blockquote><p>Sort a row&rsquo;s columns based on their real order in the table.&nbsp; This requires that the optional tbl_struct arg was passed to <a href="#ChangeHandler.new" class=LFunction id=link37 onMouseOver="ShowTip(event, 'tt3', 'link37')" onMouseOut="HideTip('tt3')">new()</a>.&nbsp; If not, the rows are sorted alphabetically.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>$row</td><td class=CDLDescription>Hashref with row values</td></tr></table><h4 class=CHeading>Returns</h4><p>Array of column names</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="ChangeHandler.make_fetch_back_query"></a>make_fetch_back_query</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub make_fetch_back_query</td></tr></table></blockquote><p>Make a SELECT statement to fetch-back values.&nbsp; This requires that the optional tbl_struct arg was passed to <a href="#ChangeHandler.new" class=LFunction id=link38 onMouseOver="ShowTip(event, 'tt3', 'link38')" onMouseOut="HideTip('tt3')">new()</a>.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>$where</td><td class=CDLDescription>Optional WHERE clause without the word &ldquo;WHERE&rdquo;</td></tr></table><h4 class=CHeading>Returns</h4><p>A SELECT statement</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="ChangeHandler._d"></a>_d</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub _d</td></tr></table></blockquote></div></div></div>
</div><!--Content-->
<div id=Footer><a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->
<div id=Menu><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent1')">Modules</a><div class=MGroupContent id=MGroupContent1><div class=MEntry><div class=MFile><a href="Advisor-pm.html">Advisor</a></div></div><div class=MEntry><div class=MFile><a href="AdvisorRules-pm.html">AdvisorRules</a></div></div><div class=MEntry><div class=MFile><a href="BinaryLogParser-pm.html">BinaryLogParser</a></div></div><div class=MEntry><div class=MFile id=MSelected>ChangeHandler</div></div><div class=MEntry><div class=MFile><a href="CompareQueryTimes-pm.html">CompareQueryTimes</a></div></div><div class=MEntry><div class=MFile><a href="CompareResults-pm.html">CompareResults</a></div></div><div class=MEntry><div class=MFile><a href="CompareTableStructs-pm.html">CompareTableStructs</a></div></div><div class=MEntry><div class=MFile><a href="CompareWarnings-pm.html">CompareWarnings</a></div></div><div class=MEntry><div class=MFile><a href="CopyRowsInsertSelect-pm.html">CopyRowsInsertSelect</a></div></div><div class=MEntry><div class=MFile><a href="Daemon-pm.html">Daemon</a></div></div><div class=MEntry><div class=MFile><a href="DSNParser-pm.html">DSNParser</a></div></div><div class=MEntry><div class=MFile><a href="DuplicateKeyFinder-pm.html">DuplicateKeyFinder</a></div></div><div class=MEntry><div class=MFile><a href="EventAggregator-pm.html">EventAggregator</a></div></div><div class=MEntry><div class=MFile><a href="EventTimeline-pm.html">EventTimeline</a></div></div><div class=MEntry><div class=MFile><a href="ExecutionThrottler-pm.html">ExecutionThrottler</a></div></div><div class=MEntry><div class=MFile><a href="ExplainAnalyzer-pm.html">ExplainAnalyzer</a></div></div><div class=MEntry><div class=MFile><a href="FileIterator-pm.html">FileIterator</a></div></div><div class=MEntry><div class=MFile><a href="ForeignKeyIterator-pm.html">ForeignKeyIterator</a></div></div><div class=MEntry><div class=MFile><a href="GeneralLogParser-pm.html">GeneralLogParser</a></div></div><div class=MEntry><div class=MFile><a href="HTTPProtocolParser-pm.html">HTTPProtocolParser</a></div></div><div class=MEntry><div class=MFile><a href="IndexUsage-pm.html">IndexUsage</a></div></div><div class=MEntry><div class=MFile><a href="InnoDBStatusParser-pm.html">InnoDBStatusParser</a></div></div><div class=MEntry><div class=MFile><a href="KeySize-pm.html">KeySize</a></div></div><div class=MEntry><div class=MFile><a href="LogSplitter-pm.html">LogSplitter</a></div></div><div class=MEntry><div class=MFile><a href="MaatkitTest-pm.html">MaatkitTest</a></div></div><div class=MEntry><div class=MFile><a href="MasterSlave-pm.html">MasterSlave</a></div></div><div class=MEntry><div class=MFile><a href="MemcachedEvent-pm.html">MemcachedEvent</a></div></div><div class=MEntry><div class=MFile><a href="MemcachedProtocolParser-pm.html">MemcachedProtocolParser</a></div></div><div class=MEntry><div class=MFile><a href="MockSth-pm.html">MockSth</a></div></div><div class=MEntry><div class=MFile><a href="MockSync-pm.html">MockSync</a></div></div><div class=MEntry><div class=MFile><a href="MockSyncStream-pm.html">MockSyncStream</a></div></div><div class=MEntry><div class=MFile><a href="MySQLConfig-pm.html">MySQLConfig</a></div></div><div class=MEntry><div class=MFile><a href="MySQLConfigComparer-pm.html">MySQLConfigComparer</a></div></div><div class=MEntry><div class=MFile><a href="MySQLDump-pm.html">MySQLDump</a></div></div><div class=MEntry><div class=MFile><a href="MySQLProtocolParser-pm.html">MySQLProtocolParser</a></div></div><div class=MEntry><div class=MFile><a href="OptionParser-pm.html">OptionParser</a></div></div><div class=MEntry><div class=MFile><a href="OSCCaptureSync-pm.html">OSCCaptureSync</a></div></div><div class=MEntry><div class=MFile><a href="Outfile-pm.html">Outfile</a></div></div><div class=MEntry><div class=MFile><a href="PgLogParser-pm.html">PgLogParser</a></div></div><div class=MEntry><div class=MFile><a href="Pipeline-pm.html">Pipeline</a></div></div><div class=MEntry><div class=MFile><a href="PodParser-pm.html">PodParser</a></div></div><div class=MEntry><div class=MFile><a href="Processlist-pm.html">Processlist</a></div></div><div class=MEntry><div class=MFile><a href="ProcesslistAggregator-pm.html">ProcesslistAggregator</a></div></div><div class=MEntry><div class=MFile><a href="Progress-pm.html">Progress</a></div></div><div class=MEntry><div class=MFile><a href="ProtocolParser-pm.html">ProtocolParser</a></div></div><div class=MEntry><div class=MFile><a href="QueryAdvisorRules-pm.html">QueryAdvisorRules</a></div></div><div class=MEntry><div class=MFile><a href="QueryParser-pm.html">QueryParser</a></div></div><div class=MEntry><div class=MFile><a href="QueryReportFormatter-pm.html">QueryReportFormatter</a></div></div><div class=MEntry><div class=MFile><a href="QueryReview-pm.html">QueryReview</a></div></div><div class=MEntry><div class=MFile><a href="QueryRewriter-pm.html">QueryRewriter</a></div></div><div class=MEntry><div class=MFile><a href="Quoter-pm.html">Quoter</a></div></div><div class=MEntry><div class=MFile><a href="ReportFormatter-pm.html">ReportFormatter</a></div></div><div class=MEntry><div class=MFile><a href="Retry-pm.html">Retry</a></div></div><div class=MEntry><div class=MFile><a href="RowDiff-pm.html">RowDiff</a></div></div><div class=MEntry><div class=MFile><a href="Runtime-pm.html">Runtime</a></div></div><div class=MEntry><div class=MFile><a href="Sandbox-pm.html">Sandbox</a></div></div><div class=MEntry><div class=MFile><a href="Schema-pm.html">Schema</a></div></div><div class=MEntry><div class=MFile><a href="SchemaIterator-pm.html">SchemaIterator</a></div></div><div class=MEntry><div class=MFile><a href="SimpleTCPDumpParser-pm.html">SimpleTCPDumpParser</a></div></div><div class=MEntry><div class=MFile><a href="SlowLogParser-pm.html">SlowLogParser</a></div></div><div class=MEntry><div class=MFile><a href="SlowLogWriter-pm.html">SlowLogWriter</a></div></div><div class=MEntry><div class=MFile><a href="SQLParser-pm.html">SQLParser</a></div></div><div class=MEntry><div class=MFile><a href="SysLogParser-pm.html">SysLogParser</a></div></div><div class=MEntry><div class=MFile><a href="TableChecksum-pm.html">TableChecksum</a></div></div><div class=MEntry><div class=MFile><a href="TableChunker-pm.html">TableChunker</a></div></div><div class=MEntry><div class=MFile><a href="TableNibbler-pm.html">TableNibbler</a></div></div><div class=MEntry><div class=MFile><a href="TableParser-pm.html">TableParser</a></div></div><div class=MEntry><div class=MFile><a href="TableSyncChunk-pm.html">TableSyncChunk</a></div></div><div class=MEntry><div class=MFile><a href="TableSyncer-pm.html">TableSyncer</a></div></div><div class=MEntry><div class=MFile><a href="TableSyncGroupBy-pm.html">TableSyncGroupBy</a></div></div><div class=MEntry><div class=MFile><a href="TableSyncNibble-pm.html">TableSyncNibble</a></div></div><div class=MEntry><div class=MFile><a href="TableSyncStream-pm.html">TableSyncStream</a></div></div><div class=MEntry><div class=MFile><a href="TableUsage-pm.html">TableUsage</a></div></div><div class=MEntry><div class=MFile><a href="TcpdumpParser-pm.html">TcpdumpParser</a></div></div><div class=MEntry><div class=MFile><a href="TCPRequestAggregator-pm.html">TCPRequestAggregator</a></div></div><div class=MEntry><div class=MFile><a href="TextResultSetParser-pm.html">TextResultSetParser</a></div></div><div class=MEntry><div class=MFile><a href="TimeSeriesTrender-pm.html">TimeSeriesTrender</a></div></div><div class=MEntry><div class=MFile><a href="Transformers-pm.html">Transformers</a></div></div><div class=MEntry><div class=MFile><a href="UpgradeReportFormatter-pm.html">UpgradeReportFormatter</a></div></div><div class=MEntry><div class=MFile><a href="VariableAdvisorRules-pm.html">VariableAdvisorRules</a></div></div><div class=MEntry><div class=MFile><a href="VersionParser-pm.html">VersionParser</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent2')">Tools</a><div class=MGroupContent id=MGroupContent2><div class=MEntry><div class=MFile><a href="../tools/pt-archiver-pm.html">pt_archiver</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-config-diff-pm.html">pt_config_diff</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-deadlock-logger-pm.html">pt_deadlock_logger</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-duplicate-key-checker-pm.html">pt_duplicate_key_checker</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-fifo-split-pm.html">pt_fifo_split</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-find-pm.html">pt_find</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-fk-error-logger-pm.html">pt_fk_error_logger</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-heartbeat-pm.html">pt_heartbeat</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-index-usage-pm.html">pt_index_usage</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-kill-pm.html">pt_kill</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-log-player-pm.html">pt_log_player</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-online-schema-change-pm.html">pt_online_schema_change</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-profile-compact-pm.html">pt_profile_compact</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-query-advisor-pm.html">pt_query_advisor</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-query-digest-pm.html">pt_query_digest</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-query-profiler-pm.html">pt_query_profiler</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-schema-advisor-pm.html">pt_schema_advisor</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-show-grants-pm.html">pt_show_grants</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-slave-delay-pm.html">pt_slave_delay</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-slave-find-pm.html">pt_slave_find</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-slave-restart-pm.html">pt_slave_restart</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-table-checksum-pm.html">pt_table_checksum</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-table-sync-pm.html">pt_table_sync</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-table-usage-pm.html">pt_table_usage</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-tcp-model-pm.html">pt_tcp_model</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-trend-pm.html">pt_trend</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-upgrade-pm.html">pt_upgrade</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-variable-advisor-pm.html">pt_variable_advisor</a></div></div><div class=MEntry><div class=MFile><a href="../tools/pt-visual-explain-pm.html">pt_visual_explain</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent3')">Index</a><div class=MGroupContent id=MGroupContent3><div class=MEntry><div class=MIndex><a href="../../index/General.html">Everything</a></div></div><div class=MEntry><div class=MIndex><a href="../../index/Classes.html">Classes</a></div></div><div class=MEntry><div class=MIndex><a href="../../index/Functions.html">Functions</a></div></div><div class=MEntry><div class=MIndex><a href="../../index/Variables.html">Variables</a></div></div></div></div></div><script type="text/javascript"><!--
var searchPanel = new SearchPanel("searchPanel", "HTML", "../../search");
--></script><div id=MSearchPanel class=MSearchPanelInactive><input type=text id=MSearchField value=Search onFocus="searchPanel.OnSearchFieldFocus(true)" onBlur="searchPanel.OnSearchFieldFocus(false)" onKeyUp="searchPanel.OnSearchFieldChange()"><select id=MSearchType onFocus="searchPanel.OnSearchTypeFocus(true)" onBlur="searchPanel.OnSearchTypeFocus(false)" onChange="searchPanel.OnSearchTypeChange()"><option id=MSearchEverything selected value="General">Everything</option><option value="Classes">Classes</option><option value="Functions">Functions</option><option value="Variables">Variables</option></select></div><script language=JavaScript><!--
HideAllBut([1], 4);// --></script></div><!--Menu-->
<!--START_ND_TOOLTIPS-->
<div class=CToolTip id="tt1"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">my $DUPE_KEY</td></tr></table></blockquote></div></div><div class=CToolTip id="tt2"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">our @ACTIONS</td></tr></table></blockquote></div></div><div class=CToolTip id="tt3"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub new</td></tr></table></blockquote></div></div><div class=CToolTip id="tt4"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub fetch_back</td></tr></table></blockquote>Set the fetch-back dbh. </div></div><div class=CToolTip id="tt5"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub set_src</td></tr></table></blockquote>Set which side of left-right pair is the source. </div></div><div class=CToolTip id="tt6"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub src</td></tr></table></blockquote>Return current source db.tbl (could be left or right table).</div></div><div class=CToolTip id="tt7"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub dst</td></tr></table></blockquote>Return current destination db.tbl (could be left or right table).</div></div><div class=CToolTip id="tt8"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub _take_action</td></tr></table></blockquote>Call the user-provied actions. </div></div><div class=CToolTip id="tt9"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub change</td></tr></table></blockquote>Make an action SQL statment for the given parameters if not queueing. </div></div><div class=CToolTip id="tt10"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub __queue</td></tr></table></blockquote>Queue an action for later execution. </div></div><div class=CToolTip id="tt11"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub process_rows</td></tr></table></blockquote>Make changes to rows created/queued earlier. </div></div><div class=CToolTip id="tt12"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub make_DELETE</td></tr></table></blockquote>Make a DELETE statement. </div></div><div class=CToolTip id="tt13"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub make_UPDATE</td></tr></table></blockquote>Make an UPDATE statement.</div></div><div class=CToolTip id="tt14"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub make_INSERT</td></tr></table></blockquote>Make an INSERT statement. </div></div><div class=CToolTip id="tt15"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub make_REPLACE</td></tr></table></blockquote>Make a REPLACE statement. </div></div><div class=CToolTip id="tt16"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub make_row</td></tr></table></blockquote>Make an INSERT or REPLACE statement. </div></div><div class=CToolTip id="tt17"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub make_where_clause</td></tr></table></blockquote>Make a WHERE clause. </div></div><div class=CToolTip id="tt18"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub get_changes</td></tr></table></blockquote>Get a summary of changes made.</div></div><div class=CToolTip id="tt19"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub sort_cols</td></tr></table></blockquote>Sort a row&rsquo;s columns based on their real order in the table. </div></div><div class=CToolTip id="tt20"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub make_fetch_back_query</td></tr></table></blockquote>Make a SELECT statement to fetch-back values. </div></div><div class=CToolTip id="tt21"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub _d</td></tr></table></blockquote></div></div><div class=CToolTip id="tt22"><div class=CClass>Quoter handles value quoting, unquoting, escaping, etc.</div></div><div class=CToolTip id="tt23"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">sub quote_val</td></tr></table></blockquote>Quote a value for use in a SQL statement. </div></div><!--END_ND_TOOLTIPS-->
<div id=MSearchResultsWindow><iframe src="" frameborder=0 name=MSearchResults id=MSearchResults></iframe><a href="javascript:searchPanel.CloseResultsWindow()" id=MSearchResultsWindowClose>Close</a></div>
<script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>