<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body ><div>If I understand your problem correctly, this is the type of work for which prepared statements are created.</div><div><br></div><div><br></div><div>$ sth = $ dbh-> prepare ("insert into table ( TIMESTAMP, KEY, VALUE ) values ( ?,?,? )";</div><div><br></div><div>$ sth-> execute($Timestamp, $Key, $Value);</div><div><br></div><div>Values passed to execute are escaped, thus preventing possible sales injection. Plus the statement handle goes through a sort of compilation making repeated use (by adding new values to the execute) much faster.</div><div><br></div><div><div style="font-size:9px;color:#575757">Sent on a Sprint Samsung Galaxy S® III</div></div><br><br><div>-------- Original message --------</div><div>From: "Robert L. Harris" <robert.l.harris@gmail.com> </div><div>Date:07/01/2014  4:22 PM  (GMT-07:00) </div><div>To: Denver-pm@pm.org </div><div>Subject: [Denver-pm] Better way to handle vars? </div><div><br></div><div dir="ltr"><div><br></div>OK, so I'm parsing a ton of data based on patterns in the lines.  Given the line I pull out 3 things,<div>Timestamp</div><div>Key</div><div>Value</div><div><br></div><div>Right now for one of my patters I have </div>

<div><br></div><div>$Insert="insert into table ( TIMESTAMP, KEY, VALUE ) values ( $Timestamp, $Key, $Value )";</div><div><br></div><div>( effectively ).</div><div><br></div><div>I'm going to have about 20+ of these patterns.  The actual insert is about 5x longer.  Is there a way to "template" the Insert so I can basically reference the template in the pattern and re-use the template?  That way if the template has to change down the line ( a new field added ) I update the template and not 20+ variables?</div>

<div><br></div><div>Robert</div><div><br clear="all"><div><br></div>-- <br>:wq!<br>---------------------------------------------------------------------------<br>Robert L. Harris<br><br>DISCLAIMER:<br>      These are MY OPINIONS             With Dreams To Be A King,<br>

       ALONE.  I speak for                      First One Should Be A Man<br>       no-one else.                                     - Manowar
</div></div>
</body>