snipt

Ctrl+h for KB shortcuts

PostgreSQL SQL dialect

update with joins for a specific project id - remove all bad characters

1
2
3
4
UPDATE step_designs AS s 
SET description =  REPLACE(s.description,'_x000D_','')
FROM qtest_designs AS t
WHERE s.qtest_design_id = t.id AND t.project_id = 2416;
https://snipt.net/embed/8b85767795a1828e0e53125b5b8c7167/
https://snipt.net/raw/8b85767795a1828e0e53125b5b8c7167/
8b85767795a1828e0e53125b5b8c7167
postgresql
PostgreSQL SQL dialect
5
2016-09-26T11:21:49
True
False
False
Jul 13, 2016 at 04:11 PM
/api/public/snipt/147392/
update-with-joins-for-a-specific-project-id-remove-all-bad-characters
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="k">UPDATE</span> <span class="n">step_designs</span> <span class="k">AS</span> <span class="n">s</span> </span><span id="L-2"><a name="L-2"></a><span class="k">SET</span> <span class="n">description</span> <span class="o">=</span> <span class="k">REPLACE</span><span class="p">(</span><span class="n">s</span><span class="mf">.</span><span class="n">description</span><span class="p">,</span><span class="s1">&#39;_x000D_&#39;</span><span class="p">,</span><span class="s1">&#39;&#39;</span><span class="p">)</span> </span><span id="L-3"><a name="L-3"></a><span class="k">FROM</span> <span class="n">qtest_designs</span> <span class="k">AS</span> <span class="n">t</span> </span><span id="L-4"><a name="L-4"></a><span class="k">WHERE</span> <span class="n">s</span><span class="mf">.</span><span class="n">qtest_design_id</span> <span class="o">=</span> <span class="n">t</span><span class="mf">.</span><span class="n">id</span> <span class="k">AND</span> <span class="n">t</span><span class="mf">.</span><span class="n">project_id</span> <span class="o">=</span> <span class="mf">2416</span><span class="p">;</span> </span></pre></div> </td></tr></table>
joins, update

Text only

Drupal: Failed to get available update data for X projects

Empty your cache_update table and try again
https://snipt.net/embed/abc9ee4b9318a3fdfe18f4f09dca309c/
https://snipt.net/raw/abc9ee4b9318a3fdfe18f4f09dca309c/
abc9ee4b9318a3fdfe18f4f09dca309c
text
Text only
1
2016-09-24T16:24:52
True
False
True
Jul 20, 2013 at 02:06 PM
/api/public/snipt/68793/
drupal-failed-to-get-available-update-data-for-x-projects
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>Empty your cache_update table and try again </span></pre></div> </td></tr></table>
"drupal 7", update

Bash

svn update with no interaction and accept certificate from cli

svn up --username <user> --password <psw> --non-interactive --trust-server-cert
https://snipt.net/embed/8ee9a30e7f44092e596ab7820a8c1502/
https://snipt.net/raw/8ee9a30e7f44092e596ab7820a8c1502/
8ee9a30e7f44092e596ab7820a8c1502
bash
Bash
1
2016-09-26T11:22:16
True
False
False
Jul 19, 2013 at 09:24 AM
/api/public/snipt/68603/
svn-update-with-no-interaction-and-accept-certificate-from-cli
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>svn up --username &lt;user&gt; --password &lt;psw&gt; --non-interactive --trust-server-cert </span></pre></div> </td></tr></table>
accept, certificate, cli, command, line, linux, shell, svn, up, update

Bash

Update Drupal core with Drush

1
2
3
4
5
# Download the latest drupal files
drush dl drupal

# Update the files & execute the database update (pm-update + updatedb)
drush up drupal
https://snipt.net/embed/bbedc9bc514d1b8df0996d2933313b05/
https://snipt.net/raw/bbedc9bc514d1b8df0996d2933313b05/
bbedc9bc514d1b8df0996d2933313b05
bash
Bash
5
2016-09-26T11:22:32
True
False
False
/api/public/snipt/54308/
update-drupal-core-with-drush
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="c"># Download the latest drupal files</span> </span><span id="L-2"><a name="L-2"></a>drush dl drupal </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="c"># Update the files &amp; execute the database update (pm-update + updatedb)</span> </span><span id="L-5"><a name="L-5"></a>drush up drupal </span></pre></div> </td></tr></table>
"drupal 7", drush, pm-update, update

SQL

mysql update with or die

$update = "UPDATE table SET name = '$muster', age = '$age', updated = now() where id = '$id' ";
mysql_query($update) or die(mysql_error());
https://snipt.net/embed/80d0f861c5c884adebdd6f6743985b29/
https://snipt.net/raw/80d0f861c5c884adebdd6f6743985b29/
80d0f861c5c884adebdd6f6743985b29
sql
SQL
2
2016-09-26T11:23:00
True
False
False
/api/public/snipt/37157/
mysql-update-with-or-die
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="err">$</span><span class="k">update</span> <span class="o">=</span> <span class="ss">&quot;UPDATE table SET name = &#39;$muster&#39;, age = &#39;$age&#39;, updated = now() where id = &#39;$id&#39; &quot;</span><span class="p">;</span> </span><span id="L-2"><a name="L-2"></a><span class="n">mysql_query</span><span class="p">(</span><span class="err">$</span><span class="k">update</span><span class="p">)</span> <span class="k">or</span> <span class="n">die</span><span class="p">(</span><span class="n">mysql_error</span><span class="p">());</span> </span></pre></div> </td></tr></table>
mysql, php, update
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.