<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — person_id as tinyblob in some tables]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=6654</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=6654&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in person_id as tinyblob in some tables.]]></description>
		<lastBuildDate>Wed, 18 Jan 2017 11:06:17 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[person_id as tinyblob in some tables]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=27407#p27407</link>
			<description><![CDATA[<p>The <strong>person_id</strong> field is either an <strong>int </strong> or a <strong>tinyblob</strong> field in FA&#039;s tables (Charts of Accounts). </p><p>The tables <strong>bank_trans, budget_trans, gl_trans</strong> have it as a <strong>tinyblob </strong>(the only ones to have tinyblob fields in FA)<strong> </strong>field type whilst the tables <strong>crm_contacts, stock_moves</strong> have it as an <strong>int</strong> type. In some instances like <strong>customers (debtors), branches, suppliers</strong>, etc., the respective <strong>id</strong> portion of the primary key references the <strong>person_id</strong> field of <strong>int</strong> type. </p><p>The <strong>tinyblob</strong> field stores the textual string as a <strong>hex</strong> number. Removing the leading <strong>0x</strong> from it, is the <strong>hex_number</strong> which can be converted using <strong>UNHEX(hex_number)</strong> function in MySQL to it&#039;s original string value.</p><p>In <strong>includes/types.inc</strong>, the <strong>function payment_person_name()</strong> (and other payment functions therein) routes the <em>person_id</em> field according to the incoming context <em>type</em> it refers to. The usage of the <strong>tinyblob</strong> field is visible in line 213 of <strong>gl/includes/db/gl_db_banking.inc</strong> in the <strong>function add_bank_transfer()</strong>:</p><div class="codebox"><pre><code>$person_id = _(&quot;From&quot;).&quot; &quot;.$fromact[&#039;bank_account_name&#039;].&quot; &quot;._(&quot;To&quot;).&quot; &quot;.$toact[&#039;bank_account_name&#039;];</code></pre></div><p>Also in lines 221 and 224 and others, the functions <strong>add_bank_trans()</strong> and <strong>add_gl_trans()</strong> use the variable <strong>$person_id</strong> assigned above.</p><p>Hence the <strong>tinyblob</strong> field can be changed to <strong>varchar</strong> or <strong>tinytext</strong> field without disturbing the code and obtaining <strong>clarity</strong> in the sql backups. We may need to deal with <strong>collations</strong> and <strong>character sets</strong> used in the database if such a change is made.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Wed, 18 Jan 2017 11:06:17 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=27407#p27407</guid>
		</item>
	</channel>
</rss>
