Re: Database
Re: Database
- Subject: Re: Database
- From: Joe Schiwall <email@hidden>
- Date: Sun, 13 Jan 2002 16:10:20 -0500
on 1/7/02 10:17 PM, Kent Glenn at email@hidden wrote:
>
I'm building an application that needs a single user/local database. I
>
really don't want to have the user install MySQL, since I think it's an
>
overkill for what I need.
>
>
I will basically need to hold customer records, with a few other small
>
tables. There will be some relationships. I'm guessing that on the avg.,
>
there will be around 5000 customer records.
Like everybody else I would love to see EOF for Obj-C/Cocoa. Just having
the flat file database adapter would be a big help, but I am not expecting
anything soon.
In the meantime, I came across an open source, LGPL licensed database engine
you may want to look at. I haven't tried it myself yet but the web site is:
<
http://linux.techass.com/projects/xdb/>
I looked at the sample code and it looks like it might be nice for what you
are trying to do, for example, to create a table:
xbSchema MyRecord[] =
{
{ "FIRSTNAME", XB_CHAR_FLD, 15, 0 },
{ "LASTNAME", XB_CHAR_FLD, 20, 0 },
{ "BIRTHDATE", XB_DATE_FLD, 8, 0 },
{ "AMOUNT", XB_NUMERIC_FLD, 9, 2 },
{ "SWITCH", XB_LOGICAL_FLD, 1, 0 },
{ "FLOAT1", XB_FLOAT_FLD, 9, 2 },
{ "FLOAT2", XB_FLOAT_FLD, 9, 1 },
{ "FLOAT3", XB_FLOAT_FLD, 9, 2 },
{ "FLOAT4", XB_FLOAT_FLD, 9, 3 },
{ "MEMO1", XB_MEMO_FLD, 10, 0 },
{ "ZIPCODE", XB_NUMERIC_FLD, 5, 0 },
{ "",0,0,0 }
};
and to access the records:
cout << "\nLoop through backwards.." << endl;
rc = MyFile.GetLastRecord();
while( rc == XB_NO_ERROR )
{
// MyFile.GetField( lname, buf );
cout << "Last Name = " << MyFile.GetStringField( lname ) << endl;
cout << "Logical Field = " << MyFile.GetLogicalField( "SWITCH" ) <<
endl;
rc = MyFile.GetPrevRecord();
}
If the engine is decent, maybe we can put an Obj-C wrapper on it so the
cocoa community would at least have some kind of DB solution for now.
Hope that helps,
Joe Schiwall
MacTelligence
References: | |
| >Database (From: Kent Glenn <email@hidden>) |