Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - PocketC Database examples

PocketC Database examples

Discuss PocketC for CE (including Desktop Edition)

Postby dm222333 on Sun Oct 07, 2007 11:56 am

Author: dreams [china]

This example PocketC details on the creation of the database, read and write databases.
Since little information publicly, for example, the primary reference for learners.

Code: Select all
/*************************************************************

   PPC database creation and reading and writing sample
   Language : PocketC
   Creation Date : 2007-10-7
   Authors : Dreams(c0der@126.com)

*************************************************************/

#define CEVT_I4 3
#define CEVT_LPWSTR 31

CreateDB(string DBName,int MyType)
{
   int DataID;
   DataID=dbcreate(DBName,MyType);
   if(DataID<=0)
   {
      putsl("Create Database Failure...");
   }
   else
   {
      putsl("Create Database Success...");
      dbopen(DataID,"");
      putsl("Database Size:"+dbsize(DataID));
   }
   dbclose();
}

WriteDB(string DBName,string Fields1,string Fields2,string Fields3,int NewRecordID)
{
   int RecordID;

   dbopen(0,DBName);
   /* New Record */
   RecordID = dbrecwrite(0,CEVT_I4,1,(int)NewRecordID);
   if(RecordID==0)
   {
      putsl("New Record Failure...");
   }
   else
   {
      RecordID = dbrecwrite(RecordID,CEVT_LPWSTR,2,(string)Fields1);
      RecordID = dbrecwrite(RecordID,CEVT_LPWSTR,3,(string)Fields2);
      RecordID = dbrecwrite(RecordID,CEVT_LPWSTR,4,(string)Fields3);
   }
   dbclose();
}

ReadDB(string DBName)
{
   int Result;
   int CurrentRecord;
   int Index;
   int RecordCount;
   int tIndex;
   
   Result = dbopen(0,DBName);
   if(Result==0)
   {
      putsl(DBName+" Open failed...");
      return;
   }
   else
   {
      RecordCount = dbnrecs(Result);
      for(Index=0;Index<RecordCount;Index++)
      {
         CurrentRecord = dbrecpropcnt();
         for(tIndex=0;tIndex<CurrentRecord;tIndex++)
         {
            if(dbrecproptype(tIndex)==3)
            {
               putsl("Value:"+dbrecpropval(tIndex)+"  Type:CEVT_I4");
            }
            else if(dbrecproptype(tIndex)==31)
            {
               putsl("Value:"+dbrecpropval(tIndex)+"  Type:CEVT_LPWSTR");;   
            }
         }
         dbseek(8,1);
         putsl("----------------------");
      }
   }
   Result = dbclose();
}
dm222333
 
Posts: 1
Joined: Sun Oct 07, 2007 11:52 am

Re: PocketC Database examples

Postby squareenix on Tue Oct 30, 2007 4:46 am

that's great
squareenix
 
Posts: 1
Joined: Tue Oct 30, 2007 4:33 am


Return to PocketC for CE

Who is online

Users browsing this forum: No registered users and 2 guests

cron