Page 1 of 1

Really Simple Database

PostPosted: Thu Jan 31, 2008 12:14 pm
by zyzix
Hi there, i'm new in this forum and have a question about Databases:

I want to create a simple Database with the fields: project-id (Text), job-id (Text), startdate(Date), enddate(Date), notice (Text). - I'm usually working with MySQL and i could write such a database in seconds, however - i don't get the clue about the PocketC Databases and how they're work. When i'm writing in the program header @dbname "mydatabase1"; and add to the code (sample code from the PocketC runtime):

Code: Select all
string strn;

puts ("Job-ID: "+strn+"\n");

while (getc() != 'x')


This is okay - but now, how i can add values to "project-id", "job-id", "startdate", "enddate", and "notice" ? How can i point to the different fields ? I have downloaded many examples and searching trough different forums and didn't find any explaination of the Database Layout of PocketC.

I hope everything is clearly because my english is not very good.

Thank you for your Help. - zyzix

Re: Really Simple Database

PostPosted: Fri Feb 01, 2008 5:28 am
by dewey
In Palm OS, a database is just a file with multiple "records". Each record is just a series of bytes. Higher level concepts such as individual fields, are not directly supported. Instead, use the dbwritex() function to write multiple fields per record.

The @dbname directive specifies the name of the "database" that the application will create. This is equivalent to the name of a .exe file. So, you don't want to be using the same name for @dbname as you would use to store data.

Re: Really Simple Database

PostPosted: Mon Feb 04, 2008 8:44 am
by zyzix
dewey wrote:Instead, use the dbwritex()

Thanks Dewey, o.k it makes sense, i've found a working example for me which actually works now, but it don't uses dbwritex() - i would appreciate it if there's any example out there which uses dbwritex() - another question: how do i put the actual date into the database ? I have a button called "Start" and if this button is activated, it should write the actual date into the db, is that a simple thing to do ? Thank you.

Re: Really Simple Database

PostPosted: Fri Feb 08, 2008 10:41 am
by zyzix
Sorry for the doublepost, just bought the OrbForms Designer and checked out the Survey Example - exactly what i needed!
Thank you for the support.