Are there reasons why the function &#39;hash&#39; (non-persistent storage) and function &#39;db&#39; (persistent storage) share a look-a-like user interface (e.g. select/insert/delete) but do not work-a-like.  In particular, in &#39;hash&#39;, insert overwrites an identical realm/data_key pair whereas &#39;db&#39; , in so far as I can tell, just blindly adds, and adds, adds, the insert(s).  However, the &#39;db&#39; select method returns one record only even if the db has accumulated many realm/data_key records, including data_value duplicates.  <br>
<br>NOTWITHSTANDING reasons-unknow-to-me, a remedy to harmonize the non-persistent &#39;hash&#39; with the persistent &#39;db&#39;  I *think* is straight forward ...<br><br>(1) At the call_limit.db schema-level, a one-time create UNIQUE COMPOUND index, as follows,<br>
<br>CREATE UNIQUE INDEX IF NOT EXISTS &#39;idx_db_data_HostRealmDK&#39; ON &#39;db_data&#39; (&#39;hostname&#39;,&#39;realm&#39;,&#39;data_key&#39;);<br><br>(1) At the c-language embedded SQL string-level,<br><br>change the existing INSERT to be the following,<br>
<br>INSERT OR REPLACE INTO db_data (hostname,realm,data_key,data) VALUES (%s,%s,%s,%s);<br><br>The index will help speed UP the reads.  Neither change is &quot;exotic&quot; and should be portable across standard sql implementations.<br>
<br>;-) ... thoughts ?<br><br>Thanks,<br><br><br><br>