<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.randomness.nu/mediawiki/index.php?action=history&amp;feed=atom&amp;title=splitsql.py</id>
	<title>splitsql.py - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.randomness.nu/mediawiki/index.php?action=history&amp;feed=atom&amp;title=splitsql.py"/>
	<link rel="alternate" type="text/html" href="https://wiki.randomness.nu/mediawiki/index.php?title=splitsql.py&amp;action=history"/>
	<updated>2026-05-24T23:59:18Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://wiki.randomness.nu/mediawiki/index.php?title=splitsql.py&amp;diff=81&amp;oldid=prev</id>
		<title>Derg: Created page with &quot; &lt;syntaxhighlight lang=&quot;python&quot;&gt; cur = &#039;beginning&#039; fi = open(cur + &#039;.sql&#039;, &#039;wb&#039;) starts = b&#039;CREATE DATABASE /*!32312 IF NOT EXISTS*/ `&#039; ends = b&#039;` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */;&#039;  with open(&#039;beforereinstallalldbs.sql&#039;, &#039;rb&#039;) as f:   for l in f:     l = l.strip()     if l.startswith(starts) and l.endswith(ends):       cur = l[len(starts):-len(ends)].decode(&#039;utf-8&#039;)       print(cur)       fi.close()       fi = open(cur + &#039;.sql&#039;, &#039;wb&#039;)...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.randomness.nu/mediawiki/index.php?title=splitsql.py&amp;diff=81&amp;oldid=prev"/>
		<updated>2024-09-17T06:26:07Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot; &amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt; cur = &amp;#039;beginning&amp;#039; fi = open(cur + &amp;#039;.sql&amp;#039;, &amp;#039;wb&amp;#039;) starts = b&amp;#039;CREATE DATABASE &lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;!32312 IF NOT EXISTS: &lt;/span&gt; `&amp;#039; ends = b&amp;#039;` &lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci: &lt;/span&gt;;&amp;#039;  with open(&amp;#039;beforereinstallalldbs.sql&amp;#039;, &amp;#039;rb&amp;#039;) as f:   for l in f:     l = l.strip()     if l.startswith(starts) and l.endswith(ends):       cur = l[len(starts):-len(ends)].decode(&amp;#039;utf-8&amp;#039;)       print(cur)       fi.close()       fi = open(cur + &amp;#039;.sql&amp;#039;, &amp;#039;wb&amp;#039;)...&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
cur = &amp;#039;beginning&amp;#039;&lt;br /&gt;
fi = open(cur + &amp;#039;.sql&amp;#039;, &amp;#039;wb&amp;#039;)&lt;br /&gt;
starts = b&amp;#039;CREATE DATABASE /*!32312 IF NOT EXISTS*/ `&amp;#039;&lt;br /&gt;
ends = b&amp;#039;` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
with open(&amp;#039;beforereinstallalldbs.sql&amp;#039;, &amp;#039;rb&amp;#039;) as f:&lt;br /&gt;
  for l in f:&lt;br /&gt;
    l = l.strip()&lt;br /&gt;
    if l.startswith(starts) and l.endswith(ends):&lt;br /&gt;
      cur = l[len(starts):-len(ends)].decode(&amp;#039;utf-8&amp;#039;)&lt;br /&gt;
      print(cur)&lt;br /&gt;
      fi.close()&lt;br /&gt;
      fi = open(cur + &amp;#039;.sql&amp;#039;, &amp;#039;wb&amp;#039;)&lt;br /&gt;
      with open(&amp;#039;beginning.sql&amp;#039;, &amp;#039;rb&amp;#039;) as fb:&lt;br /&gt;
        fi.write(fb.read())&lt;br /&gt;
        fi.write(b&amp;#039;\n&amp;#039;)&lt;br /&gt;
    fi.write(l + b&amp;#039;\n&amp;#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Derg</name></author>
	</entry>
</feed>