<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Russell, <br>
<br>
you made it much clearer than I did :-)<br>
<br>
I actually use TFieldType from Delphi and only support 4 types. I
dont have any issue with searching<br>
<br>
where (Field_Type = ftInteger) and (Field_Data between 5 and 6) <br>
<br>
where (Field_Type = ftstring) and (Field_Data = 'GLUCOSE')<br>
<br>
work just fine.<br>
<br>
<br>
<br>
Rohit<br>
<br>
On 6/03/2013 12:45 p.m., russell wrote:<br>
</div>
<blockquote cite="mid:005001ce19fb$88a42eb0$99ec8c10$@belding.co.nz"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
..shape {behavior:url(#default#VML);}
</style><![endif]-->
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Consolas","serif";
        color:black;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
..MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Rohit’s
method is like one I use that allows users to “add fields”.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Users
add records to an existing table. The program manages these
records (so it appears to users) as if they are fields.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">The
field types are important if you allow users to store data
that will not fit into a fixed length field. <o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I
allow three data types: Text, FileNames and Memo. The first
two are single lines of text of any length and the third
handles multi-line data.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">All
three types are stored as BLOBs in a Firebird db file.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">A
“con” is these fields are not easily searched … but I do not
need this ability.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Best
regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Russell<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF
1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext"
lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext"
lang="EN-US"> <a class="moz-txt-link-abbreviated" href="mailto:delphi-bounces@listserver.123.net.nz">delphi-bounces@listserver.123.net.nz</a>
[<a class="moz-txt-link-freetext" href="mailto:delphi-bounces@listserver.123.net.nz">mailto:delphi-bounces@listserver.123.net.nz</a>] <b>On
Behalf Of </b>Rohit Gupta<br>
<b>Sent:</b> Wednesday, 6 March 2013 11:49 a.m.<br>
<b>To:</b> NZ Borland Developers Group - Delphi List<br>
<b>Cc:</b> List NZ Borland Developers Group - Delphi<br>
<b>Subject:</b> Re: [DUG] Runtime user defined fields<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">I would consider having a generic table
where you soft-add the fields<br>
<br>
Ref_Num : autoinc<br>
Owner_Num : int64<br>
Field_Name : string (16)<br>
Field_Type : integer // ord(TFieldType)<br>
Field_Data : string (255) // store everything as string
but the type above tells you what it is<br>
<br>
This way you dont alter the database. You dont have to
worry about indexes etc. Everyones database is the same.
Yet you can search for data for a particular field name. I
am actually using this structure in a three projects.<br>
<br>
Regards<br>
<br>
Rohit<br>
<br>
On 6/03/2013 10:41 a.m., Steve Peacocke wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre>Hi everyone,<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>I've been away from programming for a while so please excuse the<o:p></o:p></pre>
<pre>seemingly simple question.<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>I'm designing a user interface for a new application and wondered if<o:p></o:p></pre>
<pre>there was a generally accepted way that this "should" be done.<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>The application will allow end users to edit their forms allowing them<o:p></o:p></pre>
<pre>to add, move, and remove fields at runtime. I'm using MySQL but I was<o:p></o:p></pre>
<pre>wondering if there was an accepted way of adding and changing fields<o:p></o:p></pre>
<pre>to a database.<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>I know I can use SQL for this but I also don't want to make every<o:p></o:p></pre>
<pre>application unable to be managed or upgraded. Perhaps I can ensure<o:p></o:p></pre>
<pre>that the 3-4 permanent fields are never able to be altered (ID, Name,<o:p></o:p></pre>
<pre>etc) but allow the user (through a suitable user-friendly interface)<o:p></o:p></pre>
<pre>to go crazy adding such fields as My_favourite_colour, Rating,<o:p></o:p></pre>
<pre>Priority, Notes, etc. etc.<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>I'm able to give a suitable user-friendly interface to allow them to<o:p></o:p></pre>
<pre>physically alter the Delphi form at runtime, but wondered about the<o:p></o:p></pre>
<pre>"most appropriate way" to modify the fields to the database.<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>1. I could simply add fields using SQL's ALTER TABLE<o:p></o:p></pre>
<pre>2. I could add another table with fields such as TableName, FieldName,<o:p></o:p></pre>
<pre>Type, etc.. and add to that<o:p></o:p></pre>
<pre>3. Some other spiffy way that you people will suggest that I haven't<o:p></o:p></pre>
<pre>even thought of yet.<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Any suggestions?<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Steve Peacocke<o:p></o:p></pre>
<pre>+64 220 612-611<o:p></o:p></pre>
<pre><a moz-do-not-send="true" href="http://www.nzorient.co.nz">http://www.nzorient.co.nz</a><o:p></o:p></pre>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>NZ Borland Developers Group - Delphi mailing list<o:p></o:p></pre>
<pre>Post: <a moz-do-not-send="true" href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><o:p></o:p></pre>
<pre>Admin: <a moz-do-not-send="true" href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a><o:p></o:p></pre>
<pre>Unsubscribe: send an email to <a moz-do-not-send="true" href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre>__________ Information from ESET Endpoint Antivirus, version of virus signature database 8081 (20130305) __________<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>The message was checked by ESET Endpoint Antivirus.<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre><a moz-do-not-send="true" href="http://www.eset.com">http://www.eset.com</a><o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
</blockquote>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
<div>
<p class="MsoNormal">-- <br>
Regards<br>
<br>
<b>Rohit Gupta</b><br>
B.E. Elec., M.E., Mem IEEE, Member IET<br>
Technical Director<br>
Computer Fanatics Ltd<br>
<br>
<b>Tel </b>4892280 <br>
<b>Fax </b>4892290 <br>
<b>Web </b><a moz-do-not-send="true" href="www.cfl.co.nz">www.cfl.co.nz</a><o:p></o:p></p>
<div class="MsoNormal" style="text-align:center"
align="center">
<hr size="2" width="100%" align="center"></div>
<p class="MsoNormal">This email and any attachments contain
information, which is confidential and may be subject to
legal privilege and copyright. If you are not the intended
recipient, you must not use, distribute or copy this email
or attachments. If you have received this in error, please
notify us immediately by return email and then delete this
email and any attachments.<o:p></o:p></p>
</div>
</div>
<br>
<br>
__________ Information from ESET Endpoint Antivirus, version of
virus signature database 8082 (20130305) __________<br>
<br>
The message was checked by ESET Endpoint Antivirus.<br>
<br>
<a moz-do-not-send="true" href="http://www.eset.com">http://www.eset.com</a><br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: <a class="moz-txt-link-abbreviated" href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a>
Admin: <a class="moz-txt-link-freetext" href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a>
Unsubscribe: send an email to <a class="moz-txt-link-abbreviated" href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe
__________ Information from ESET Endpoint Antivirus, version of virus signature database 8082 (20130305) __________
The message was checked by ESET Endpoint Antivirus.
<a class="moz-txt-link-freetext" href="http://www.eset.com">http://www.eset.com</a>
</pre>
</blockquote>
<br>
<br>
<div class="moz-signature">-- <br>
Regards<br>
<br>
<b>Rohit Gupta</b><br>
B.E. Elec., M.E., Mem IEEE, Member IET<br>
Technical Director<br>
Computer Fanatics Ltd<br>
<br>
<b>Tel </b>4892280 <br>
<b>Fax </b>4892290 <br>
<b>Web </b><a href="www.cfl.co.nz">www.cfl.co.nz</a><br>
<hr>
This email and any attachments contain information, which is
confidential and may be subject to legal privilege and copyright.
If you are not the intended recipient, you must not use,
distribute or copy this email or attachments. If you have received
this in error, please notify us immediately by return email and
then delete this email and any attachments.</div>
</body>
</html>