<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Simple database engine?</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/26434/simple-database-engine</link><description> 
Hallo 

 
Do somebody know of a simpel, small database engine for C?? 

 
This is the scenario: 

 
Car information (Make, model name, year etc) are presented in a
Excel spread sheet. The information is text based. 
The same information is then put</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Simple database engine?</title><link>https://community.arm.com/thread/58977?ContentTypeID=1</link><pubDate>Tue, 14 Dec 2010 10:41:28 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:88b3da4f-09f0-4555-86a8-1c7e18a168ff</guid><dc:creator>HansBernhard Broeker</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;I have SQLite in mind, but is it overkill for the task
??;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Only about as much as using a 5 pound sledgehammer to squash a
mosquito would be. ;-) For the job at hand, you don&amp;#39;t need a database
engine at all, much less a relational DBMS toting SQL.&lt;/p&gt;

&lt;p&gt;
For the amount of data you&amp;#39;re looking at, your controller can
quite probably go through the entire dataset before the human user
notices that you&amp;#39;re using any time at all. I.e. there&amp;#39;s not even a
strict necessity to precompute anything.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Simple database engine?</title><link>https://community.arm.com/thread/66098?ContentTypeID=1</link><pubDate>Tue, 14 Dec 2010 07:40:00 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c1520f9f-5317-4968-af32-114f2b2ecd85</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Databases are good for doing _operations_ on data.&lt;/p&gt;

&lt;p&gt;
You don&amp;#39;t mention anything about adding/changing any data in your
device. And you only seem to have a single table, so you obviously
don&amp;#39;t seem to need any relational operations where you perform any
join between multiple tables.&lt;/p&gt;

&lt;p&gt;
Then it is probably simplest to have:&lt;/p&gt;

&lt;pre&gt;
typedef struct {
    int field1;
    char field2[20];
    char field3[10];
} rec_t;

rec_t my_data[] = {
    {17,&amp;quot;hello&amp;quot;,&amp;quot;there&amp;quot;},
    {30,&amp;quot;benny&amp;quot;,&amp;quot;drunk&amp;quot;},
    {9,&amp;quot;late&amp;quot;,&amp;quot;night&amp;quot;}};
unsigned sort1[] = {2,0,1};
unsigned sort2[] = {1,0,2};
unsigned sort3[] = {1,2,0};
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
Then you can browse the data sorted using the lookup tables sort1,
sort2, sort3 as you want.&lt;/p&gt;

&lt;p&gt;
And you can use bsearch on a sortx[] array to locate an entry in
log2 n attempts if you have n entries.&lt;/p&gt;

&lt;p&gt;
If you have the time, and don&amp;#39;t want to precomute multiple sort
arrays to index the data, you can just use qsort() to sort the
entries before letting the user browsing them. Running qsort() on an
array of just integers mapping to the real entries means you don&amp;#39;t
need to copy any actual data - so the table data can be kept in flash
all the time and one table of n integers (+ stack space for qsort)
are your RAM requirements.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>