<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -156,12 +156,34 @@ sub init {
 }
 
 ########################################################
+# Yes, this is ugly, and we can ditch it in about 6 months
+# Turn off autocommit here
+sub sqlTransactionStart {
+	my($self, $arg) = @_;
+	$self-&gt;sqlDo($arg);
+}
+
+########################################################
+# Put commit here
+sub sqlTransactionFinish {
+	my($self) = @_;
+	$self-&gt;sqlDo(&quot;UNLOCK TABLES&quot;);
+}
+
+########################################################
+# In another DB put rollback here
+sub sqlTransactionCancel {
+	my($self) = @_;
+	$self-&gt;sqlDo(&quot;UNLOCK TABLES&quot;);
+}
+
+########################################################
 # Bad need of rewriting....
 sub createComment {
 	my($self, $form, $user, $pts, $default_user) = @_;
 	my $sid_db = $self-&gt;{_dbh}-&gt;quote($form-&gt;{sid});
 
-	$self-&gt;sqlDo(&quot;LOCK TABLES comments WRITE&quot;);
+	$self-&gt;sqlTransactionStart(&quot;LOCK TABLES comments WRITE&quot;);
 	my($maxCid) = $self-&gt;sqlSelect(
 		&quot;max(cid)&quot;, &quot;comments&quot;, &quot;sid=$sid_db&quot;
 	);
@@ -173,7 +195,7 @@ sub createComment {
 		$self-&gt;{_dbh}-&gt;quote($form-&gt;{postercomment}) . &quot;,&quot; .
 		($form-&gt;{postanon} ? $default_user : $user-&gt;{uid}) . &quot;, $pts,-1,0)&quot;;
 
-	$self-&gt;sqlDo(&quot;UNLOCK TABLES&quot;);
+	$self-&gt;sqlTransactionFinish();
 	# don't allow pid to be passed in the form.
 	# This will keep a pid from being replace by
 	# with other comment's pid
@@ -1599,7 +1621,7 @@ sub setMetaMod {
 	my $returns = [];
 
 	# Update $muid's Karma
-	$self-&gt;sqlDo(&quot;LOCK TABLES users_info WRITE, metamodlog WRITE&quot;);
+	$self-&gt;sqlTransactionStart(&quot;LOCK TABLES users_info WRITE, metamodlog WRITE&quot;);
 	for (keys %{$m2victims}) {
 		my $muid = $m2victims-&gt;{$_}[0];
 		my $val = $m2victims-&gt;{$_}[1];
@@ -1631,7 +1653,7 @@ sub setMetaMod {
 			-flag =&gt; $flag
 		});
 	}
-	$self-&gt;sqlDo(&quot;UNLOCK TABLES&quot;);
+	$self-&gt;sqlTransactionFinish();
 
 	return $returns;
 }
@@ -2260,11 +2282,8 @@ sub getStoryList {
 	my $form = getCurrentForm();
 
 	# CHANGE DATE_ FUNCTIONS
-	my $sql = q[SELECT storiestuff.hits, commentcount, stories.sid, title, uid,
-			date_format(time,&quot;%k:%i&quot;) as t,tid,section,
-			displaystatus,writestatus,
-			date_format(time,&quot;%W %M %d&quot;),
-			date_format(time,&quot;%m/%d&quot;)
+	my $sql = q[SELECT storiestuff.hits, commentcount, stories.sid, title, uid, time, tid, section,
+			displaystatus,writestatus
 			FROM stories,storiestuff
 			WHERE storiestuff.sid=stories.sid];
 	$sql .= &quot;	AND section='$user-&gt;{section}'&quot; if $user-&gt;{section};</diff>
      <filename>Slash/DB/MySQL/MySQL.pm</filename>
    </modified>
    <modified>
      <diff>@@ -78,13 +78,13 @@ sub setStoryIndex {
 	for my $sid (@sids) {
 		$stories{$sid} = $self-&gt;sqlSelectHashref(&quot;*&quot;,&quot;stories&quot;,&quot;sid='$sid'&quot;);
 	}
-	$self-&gt;{_dbh}-&gt;do(&quot;LOCK TABLES newstories WRITE&quot;);
+	$self-&gt;{_dbh}-&gt;sqlTransactionStart(&quot;LOCK TABLES newstories WRITE&quot;);
 
 	foreach my $sid (keys %stories) {
 		$self-&gt;sqlReplace(&quot;newstories&quot;, $stories{$sid}, &quot;sid='$sid'&quot;);
 	}
 
-	$self-&gt;{_dbh}-&gt;do(&quot;UNLOCK TABLES&quot;);
+	$self-&gt;{_dbh}-&gt;sqlTransactionFinish();
 }
 
 ########################################################
@@ -213,13 +213,13 @@ sub updateStamps {
 
 	my $E = $self-&gt;sqlSelectAll($columns, $tables, $where, $other);
 
-	$self-&gt;sqlDo(&quot;LOCK TABLES users_info WRITE&quot;);
+	$self-&gt;sqlTransactionStart(&quot;LOCK TABLES users_info WRITE&quot;);
 
 	for (@{$E}) {
 		my $uid=$_-&gt;[0];
 		$self-&gt;setUser($uid, {-lastaccess=&gt;'now()'});
 	}
-	$self-&gt;sqlDo(&quot;UNLOCK TABLES&quot;);
+	$self-&gt;sqlTransactionFinish();
 }
 
 ########################################################
@@ -371,9 +371,7 @@ sub tokens2points {
 	my $constants = getCurrentStatic();
 	my @log;
 	my $c = $self-&gt;sqlSelectMany(&quot;uid,tokens&quot;, &quot;users_info&quot;, &quot;tokens &gt;= $constants-&gt;{maxtokens}&quot;);
-	$self-&gt;sqlDo(&quot;LOCK TABLES users READ, 
-		users_info WRITE, 
-		users_comments WRITE&quot;);
+	$self-&gt;sqlTransactionStart(&quot;LOCK TABLES users READ, users_info WRITE, users_comments WRITE&quot;);
 
 	while (my($uid, $tokens) = $c-&gt;fetchrow) {
 		push @log, (&quot;Giving $constants-&gt;{maxtokens}/$constants-&gt;{tokensperpoint} &quot; .
@@ -393,13 +391,13 @@ sub tokens2points {
 		 seclev &lt; 100 AND
 		 users.uid=users_comments.uid AND
 		 users.uid=users_info.uid&quot;);
-	$self-&gt;sqlDo(&quot;UNLOCK TABLES&quot;);
+	$self-&gt;sqlTransactionFinish();
 
-	$self-&gt;sqlDo(&quot;LOCK TABLES users_comments WRITE&quot;);
+	$self-&gt;sqlTransactionStart(&quot;LOCK TABLES users_comments WRITE&quot;);
 	while (my($uid) = $c-&gt;fetchrow) {
 		$self-&gt;sqlUpdate(&quot;users_comments&quot;, { points =&gt; 5 } ,&quot;uid=$uid&quot;);
 	}
-	$self-&gt;sqlDo(&quot;UNLOCK TABLES&quot;);
+	$self-&gt;sqlTransactionFinish();
 
 	return \@log;
 }
@@ -419,14 +417,14 @@ sub stirPool {
 
 	my $revoked = 0;
 
-	$self-&gt;sqlDo(&quot;LOCK TABLES users_comments WRITE&quot;);
+	$self-&gt;sqlTransactionStart(&quot;LOCK TABLES users_comments WRITE&quot;);
 
 	while (my($p, $u) = $c-&gt;fetchrow) {
 		$revoked += $p;
 		$self-&gt;sqlUpdate(&quot;users_comments&quot;, { points =&gt; '0' }, &quot;uid=$u&quot;);
 	}
 
-	$self-&gt;sqlDo(&quot;UNLOCK TABLES&quot;);
+	$self-&gt;sqlTransactionFinish();
 	$c-&gt;finish;
 	return 0;
 }
@@ -512,14 +510,14 @@ sub giveKarma {
 	}
 
 
-	$self-&gt;sqlDo(&quot;LOCK TABLES users_info WRITE&quot;);
+	$self-&gt;sqlTransactionStart(&quot;LOCK TABLES users_info WRITE&quot;);
 	for (@eligibles) {
 		next unless $scores[$uid];
 		$self-&gt;setUser($uid, { 
 			-tokens	=&gt; &quot;tokens+&quot; . $scores[$uid]
 		});
 	}
-	$self-&gt;sqlDo(&quot;UNLOCK TABLES&quot;);
+	$self-&gt;sqlTransactionFinish();
 
 	return(&quot;Start at $st end at $fi.  $eligible left. First score is $cnt&quot;);
 }</diff>
      <filename>Slash/DB/Static/MySQL/MySQL.pm</filename>
    </modified>
    <modified>
      <diff>@@ -1117,7 +1117,10 @@ sub listStories {
 
 	for (@$storylist) {
 		($hits, $comments, $sid, $title, $aid, $time, $tid, $section,
-			$displaystatus, $writestatus, $td, $td2) = @$_;
+			$displaystatus, $writestatus) = @$_;
+		$time = timeCalc($time, '%H:%M');
+		my $td = timeCalc($time, '%A %B %d');
+		my $td2 = timeCalc($time, '%m/%d');
 
 		$substrtid = substr($tid, 0, 5);
 		</diff>
      <filename>plugins/Admin/admin.pl</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>0cedd747a1b5e4ecc3c7232af93e277beb4d2fd9</id>
    </parent>
  </parents>
  <author>
    <name>Brian Aker</name>
    <email>brian@tangent.org</email>
  </author>
  <url>http://github.com/scc/slash/commit/d77f54cfd47befc5d14c22c1cb20ccc405b31981</url>
  <id>d77f54cfd47befc5d14c22c1cb20ccc405b31981</id>
  <committed-date>2001-04-24T10:17:51-07:00</committed-date>
  <authored-date>2001-04-24T10:17:51-07:00</authored-date>
  <message>Committing fixes</message>
  <tree>362f51fce664cc398dc87c353583b4c7efe8db87</tree>
  <committer>
    <name>Brian Aker</name>
    <email>brian@tangent.org</email>
  </committer>
</commit>
