Like Tree1Likes

New DataBase in c language

This is a discussion on New DataBase in c language within the Projects and Job Recruitment forums, part of the Community Boards category; I have written this little database through the years and it seems to be working right now. I would like ...

  1. #1
    Registered User LísiasDeCastro's Avatar
    Join Date
    Aug 2013
    Location
    Brasil/São Paulo
    Posts
    18

    New DataBase in c language

    I have written this little database through the years and it seems to be working right now. I would like you all to test it out and tell me if it is helpfull. If anyone is interested in help me to update it of course you can contact me by email. Thanks for everyone.

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    2,301
    post the code here if you want users of this forum to look at it.
    Code:
    namespace life
    {
        const bool change = true;
    }

  3. #3
    Registered User LísiasDeCastro's Avatar
    Join Date
    Aug 2013
    Location
    Brasil/São Paulo
    Posts
    18
    Code:
    #ifndef __MAIN_H__
    #define __MAIN_H__
    
    
    /*  To use this exported function of dll, include this header
     *  in your project.
     */
    
    
    #ifdef BUILD_DLL
        #define UNIVERSE_FUNCTION __declspec(dllexport)
    #else
        #define UNIVERSE_FUNCTION __declspec(dllimport)
    #endif
    
    
    #ifdef __cplusplus
    extern "C"
    {
    #endif
    
    double UNIVERSE_FUNCTION Percent(double Total,double ManyPercent);
    
    typedef unsigned int UINT;
    typedef unsigned char BYTE;
    
    typedef enum{Off,On}STATUS;
    
    char * UNIVERSE_FUNCTION LocalPath();
    STATUS UNIVERSE_FUNCTION Exists(char * Name,char * Dir);
    
    typedef struct{
      int    Length;
      char * Text;
      }STRING,*PSTRING;
    
    STRING UNIVERSE_FUNCTION Write(const char *);
    
    typedef struct{
      PSTRING Type,Value;
      UINT Max;
      }CLASS,*PCLASS;
    
    typedef struct{
      PSTRING Buffer;
      UINT Max;
      }DATA,*PDATA;
    
    typedef struct{
      STRING ClassFile,DataFile,Path,Root;
      CLASS Class;
      DATA  Data;
      }UNIVERSE,*PUNIVERSE;
    
    void   UNIVERSE_FUNCTION CreateUniverse(PUNIVERSE ToCreate,const char * Clan,const char * Class);
    void   UNIVERSE_FUNCTION InsertClass(PUNIVERSE ToInsert,const char * Type,const char * Value);
    void   UNIVERSE_FUNCTION SaveClass(UNIVERSE ToSave);
    STATUS UNIVERSE_FUNCTION MaxClass(UNIVERSE ToCheck);
    void   UNIVERSE_FUNCTION StartData(UNIVERSE ToStart);
    void   UNIVERSE_FUNCTION AppendData(char * Type,char * Value);
    STATUS UNIVERSE_FUNCTION Equal(UNIVERSE ToCompare,char * ClassName);
    void   UNIVERSE_FUNCTION InsertData(PUNIVERSE ToInsert);
    STATUS UNIVERSE_FUNCTION ModifyData(PUNIVERSE ToModify,char * Key);
    void   UNIVERSE_FUNCTION RemoveData(PUNIVERSE ToRemove,char * Key);
    void   UNIVERSE_FUNCTION SaveAllData(UNIVERSE ToSave);
    void   UNIVERSE_FUNCTION SaveLastData(UNIVERSE ToSave);
    STATUS UNIVERSE_FUNCTION MaxData(UNIVERSE ToCheck);
    void   UNIVERSE_FUNCTION RemoveClassFile(PUNIVERSE ToRemove);
    void   UNIVERSE_FUNCTION RemoveDataFile(PUNIVERSE ToRemove);
    char * UNIVERSE_FUNCTION DoubleToString(double ToConvert);
    char * UNIVERSE_FUNCTION IntToString(int ToConvert);
    
    typedef struct{
      UINT Tick,OldTick,Interval;
      }WAIT,*PWAIT;
    
    typedef struct{
      BYTE R,G,B,A;
      }COLOR,*PCOLOR;
    
    void  UNIVERSE_FUNCTION RedColor(PCOLOR ToRed,BYTE Red);
    void  UNIVERSE_FUNCTION GreenColor(PCOLOR ToGreen,BYTE Green);
    void  UNIVERSE_FUNCTION BlueColor(PCOLOR ToBlue,BYTE Blue);
    void  UNIVERSE_FUNCTION AlphaColor(PCOLOR ToAlpha,BYTE Alpha);
    COLOR UNIVERSE_FUNCTION RGBAColor(BYTE Red,BYTE Green,BYTE Blue,BYTE Alpha);
    
    typedef struct{
      PSTRING Name,Path,Pattern,Action;
      UINT Max,Update,Position;
      WAIT Timer;
      }IMAGE,*PIMAGE;
    
    void  UNIVERSE_FUNCTION CreateImage(PIMAGE,char *);
    
    typedef struct{
      PSTRING Name,Path,Pattern,Loop;
      UINT Max,Update;
      double Volume,Balance,Speed;
      WAIT Timer;
      }SOUND,*PSOUND;
    
    void  UNIVERSE_FUNCTION CreateSound(PSOUND,char *);
    
    typedef struct{
      STRING Clan,ID,ImageClan,SoundClan;
      double Width,Height,WidthOffset,HeightOffset;
      double WidthSize,HeightSize,WidthSizeOffset,HeightSizeOffset;
      double X,Y,XOffset,YOffset,Angle,AngleOffset;
      double XView,YView,XViewOffset,YViewOffset;
      double XScroll,YScroll,XScrollOffset,YScrollOffset;
      double XSpeed,YSpeed,XSpeedOffset,YSpeedOffset;
      COLOR Color;
      IMAGE ImageInfo;
      SOUND SoundInfo;
      }OBJECT,*POBJECT;
    
    void   UNIVERSE_FUNCTION CreateObject(POBJECT ToCreate,char * Clan,char * Id);
    double UNIVERSE_FUNCTION Width(POBJECT Object,double ToChange);
    double UNIVERSE_FUNCTION Height(POBJECT Object,double ToChange);
    double UNIVERSE_FUNCTION WidthSize(POBJECT Object,double ToChange);
    double UNIVERSE_FUNCTION HeightSize(POBJECT Object,double ToChange);
    double UNIVERSE_FUNCTION XSpeed(POBJECT Object,double ToChange);
    double UNIVERSE_FUNCTION YSpeed(POBJECT Object,double ToChange);
    STATUS UNIVERSE_FUNCTION XAround(OBJECT Object,double Min,double Max);
    STATUS UNIVERSE_FUNCTION XIncrease(POBJECT Object,double Max);
    STATUS UNIVERSE_FUNCTION XDecrease(POBJECT Object,double Min);
    STATUS UNIVERSE_FUNCTION YAround(OBJECT Object,double Min,double Max);
    STATUS UNIVERSE_FUNCTION YIncrease(POBJECT Object,double Max);
    STATUS UNIVERSE_FUNCTION YDecrease(POBJECT Object,double Min);
    STATUS UNIVERSE_FUNCTION XViewAround(OBJECT Object,double Begin,double End);
    STATUS UNIVERSE_FUNCTION XViewIncrease(POBJECT Object,double Max);
    STATUS UNIVERSE_FUNCTION XViewDecrease(POBJECT Object,double Min);
    STATUS UNIVERSE_FUNCTION YViewAround(OBJECT Object,double Begin,double End);
    STATUS UNIVERSE_FUNCTION YViewIncrease(POBJECT Object,double Max);
    STATUS UNIVERSE_FUNCTION YViewDecrease(POBJECT Object,double Min);
    STATUS UNIVERSE_FUNCTION XScrollAround(OBJECT Object,double Begin,double End);
    STATUS UNIVERSE_FUNCTION XScrollIncrease(POBJECT Object,double Max);
    STATUS UNIVERSE_FUNCTION XScrollDecrease(POBJECT Object,double Min);
    STATUS UNIVERSE_FUNCTION YScrollAround(OBJECT Object,double Begin,double End);
    STATUS UNIVERSE_FUNCTION YScrollIncrease(POBJECT Object,double Max);
    STATUS UNIVERSE_FUNCTION YScrollDecrease(POBJECT Object,double Min);
    void   UNIVERSE_FUNCTION InsertImage(POBJECT ToInsert,char * Name,char * Path,char * Action);
    void   UNIVERSE_FUNCTION SaveImage(OBJECT ToInsert);
    void   UNIVERSE_FUNCTION InsertSound(POBJECT ToInsert,char * Name,char * Path);
    double UNIVERSE_FUNCTION SoundVolume(POBJECT ToChange,double Volume);
    double UNIVERSE_FUNCTION SoundBalance(POBJECT ToChange,double Balance);
    double UNIVERSE_FUNCTION SoundSpeed(POBJECT ToChange,double Speed);
    void   UNIVERSE_FUNCTION SaveSound(OBJECT ToSave);
    void   UNIVERSE_FUNCTION SaveObject(OBJECT ToSave);
    
    #ifdef __cplusplus
    }
    #endif
    
    #endif // __MAIN_H__

  4. #4
    Registered User LísiasDeCastro's Avatar
    Join Date
    Aug 2013
    Location
    Brasil/São Paulo
    Posts
    18
    This is the very code of the database. If you wish to test it out you can contact me by the email saisilcastro@gmail.com and I will send you the lib and dll file. Thanks for everyone.

  5. #5
    Registered User
    Join Date
    Oct 2006
    Posts
    2,301
    it's unlikely that you'll find someone on here who wants to download your proprietary dll to try out your database. how do we know that you don't have some sort of unfriendly code in there? you need to post source if you want people to try it.
    Code:
    namespace life
    {
        const bool change = true;
    }

  6. #6
    Registered User LísiasDeCastro's Avatar
    Join Date
    Aug 2013
    Location
    Brasil/São Paulo
    Posts
    18
    Quote Originally Posted by Elkvis View Post
    it's unlikely that you'll find someone on here who wants to download your proprietary dll to try out your database. how do we know that you don't have some sort of unfriendly code in there? you need to post source if you want people to try it.
    Hi Elkvis. I've posted the code above. The lib and dll will only be used in order to link it into the compiler, just like the allegro bin or another lib you can download. I can't make you to trust me, but I am a serious programmer and I am trying to do something usefull for every programmer. And I think this is the solution for many troubles which the c programmers find on the way. I am working by myself since 16 years old, and I won't give it up, even if none of the programmers trusts me. Anyway thanks for replying.

  7. #7
    Registered User
    Join Date
    Oct 2006
    Posts
    2,301
    what you posted is not code. it is a series of declarations. you will need to post your .c or .cpp files and anything else that goes into building the lib/dll. like I said, nobody will want to download your dll and use it because of the risk of viruses and other malicious code.
    Code:
    namespace life
    {
        const bool change = true;
    }

  8. #8
    Registered User
    Join Date
    May 2010
    Posts
    2,698
    That code doesn't really tell you anything.

    Without any documentation why would I or anyone else use this "database"?

    How is this "database" supposed to be used?

    What is the purpose of this "database"?

    And as already stated downloading a lib or dll from an unknown anonymous source can be a security threat.

    Jim

  9. #9
    Registered User LísiasDeCastro's Avatar
    Join Date
    Aug 2013
    Location
    Brasil/São Paulo
    Posts
    18
    Quote Originally Posted by jimblumberg View Post
    That code doesn't really tell you anything.

    Without any documentation why would I or anyone else use this "database"?

    How is this "database" supposed to be used?

    What is the purpose of this "database"?

    And as already stated downloading a lib or dll from an unknown anonymous source can be a security threat.

    Jim
    this is the way you can use the database.

    Code:
    typedef struct{
      STRING Name;
      UINT age;
      }PERSON,*PPERSON;
    
    void LoadPerson(PPERSON ToCreate,char * clan){
      UNIVERSE Person;
      CreateUniverse(&Person,"Class",Clan);
      if(!MaxClass(Person){
        InsertClass(&Person,"Word","Name");
        InsertClass(&Person,"Int","Age");
        SaveClass(Person);
        }
      ToCreate->Name = Write("Lísias de Castro");
      ToCreate->Age = 24;
      if(MaxData(Person)){
        UINT LastData,LastClass=0;
        for(LastData=0;LastData<Person.Data.Max;LastData++){
          if(!strncmp(Person.Class.Value,"Name",strlen("Name"))
            ToCreate.Name = Write(Data.Data.Buffer[LastData].Text);
          if(!strncmp(Person.Class.Value,"Age",strlen("Age"))
            ToCreate.Age = atoi(Data.Data.Buffer[LastData].Text);
          LastClass++;
          if(LastClass==Person.Class.Max){
            LastClass=0;
            }
          }
        }
      }
    
    void SavePerson(PERSON ToSave,char * clan){
      UNIVERSE Person;
      CreateUniverse(&Person,"Class",clan);
      StartObject(ToSave);
      AppendData("Name",ToSave->Name.Text);
      AppendData("Age",IntToString(ToSave->Age));
      if(!Equal(Person,"Name")){ // Insert Data if it not exists
        InsertData(&Person);
        SaveLastData(Person);
        }
      else { // Modify it if exists
        if(ModifyData(&Person,ToSave->Name.Text))SaveAllData(Person);
        }
      }
    
    main{
      PERSON Object;
      LoadPerson(&Object);
      SavePerson(Object);
      return 0;
      }
    I hope you all believe my work. ^^

  10. #10
    Registered User
    Join Date
    May 2010
    Posts
    2,698
    For what purpose would I use this "database"?

    Where is the documentation?

    For what type of program would this "database" be useful?

    Jim

  11. #11
    Registered User LísiasDeCastro's Avatar
    Join Date
    Aug 2013
    Location
    Brasil/São Paulo
    Posts
    18

    This can be usefull for everything you want to in c language

    Quote Originally Posted by jimblumberg View Post
    For what purpose would I use this "database"?

    Where is the documentation?

    For what type of program would this "database" be useful?

    Jim
    Hi Jim. I am doing an integration of this database with the allegro library. But it can be useful to do console programs or any other thing you can think out. I have no documentation of it, because I am working on it by myself, and there's too much code to implement into allegro. I am releasing this because I've tried to use database like mysql in c and it is to hard to configure it. So I made it in order to make the life of the programmer easier.
    I don't know how I can prove which it is working. But if you test it, you will see it working.
    Sorry for my poor english, I learned it at home, just like programmation. Because here in Brasil
    they don't give us much option to learn. If you don't have enough will, You won't reach any place.

  12. #12
    Registered User LísiasDeCastro's Avatar
    Join Date
    Aug 2013
    Location
    Brasil/São Paulo
    Posts
    18
    Hey guys. I updated my profile in order to be checked for everyone. Who believes that I'm working seriously here and have some doubt about the database, it's only to ask the question. But I guess that example could show how easy it is to be used. Thanks for the attention, ok?

  13. #13
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    That's certainly an interesting post.

    I don't have the anti-virus protection needed to d/l and run such programs, but seeing the sound functions, I'm very curious what is their purpose?

    And a similar question about the several X or Y functions. Are they to adjust the output of queries made to the database program?

  14. #14
    Registered User LísiasDeCastro's Avatar
    Join Date
    Aug 2013
    Location
    Brasil/São Paulo
    Posts
    18
    The database itself goes until machine setting. The other things are to integrate the graphic libraries in a global way. That way you don't have to remake your code every time. I am showing my allegro library and you will see what I am doing with this.
    Code:
    #ifndef MACHINE_H
    #define MACHINE_H
    #include <time.h>
    #include <allegro5/allegro.h>
    #include <allegro5/allegro_image.h>
    #include <allegro5/allegro_primitives.h>
    #include <allegro5/allegro_native_dialog.h>
    #include <allegro5/allegro_audio.h>
    #include <universe.h>
    typedef struct{
      double Width,Height,WidthOffset,HeightOffset;
      STRING Clan,ID,Mode,Manager;
      ALLEGRO_DISPLAY * View;
      COLOR Color;
      }VIDEO,*PVIDEO;
    void CreateVideo(PVIDEO ToCreate,char *,char *);
    void SaveVideo(VIDEO);
    typedef struct{
      VIDEO Camera;
      ALLEGRO_EVENT_QUEUE * EventRow;
      ALLEGRO_EVENT Event;
      STATUS Run,Mouse,Audio;
      STRING Clan,ID;
      }MACHINE,*PMACHINE;
    void CreateMachine(PMACHINE MachineLeader,char *,char *,char *);
    STATUS RunMachine(PMACHINE MachineLeader,char *,char *,char *);
    STATUS RunningMachine(MACHINE MachineLeader);
    STATUS GetKeyMachine(MACHINE MachineLeader,int);
    void StopMachine(PMACHINE MachineLeader);
    void SaveMachine(MACHINE MachineLeader);
    void ClearMachine(MACHINE MachineLeader);
    typedef struct{
      OBJECT Object;
      ALLEGRO_BITMAP * Image;
      ALLEGRO_SAMPLE * Sound;
      ALLEGRO_AUDIO_STREAM * SoundStream;
      }AL_OBJECT,*AL_POBJECT;
    void LoadALObject(AL_POBJECT,char *);
    void GetImage(AL_POBJECT,char *);
    void DrawAlObject(AL_OBJECT);
    void GetSound(AL_POBJECT,char *);
    void SoundLoopType(AL_POBJECT ToChange,const char * SoundLoop);
    void PlayAudio(AL_OBJECT);
    typedef enum{
      MAP_LEFT =0,
      MAP_RIGHT=1,
      MAP_UP   =2,
      MAP_DOWN =3
      }MAPMOVE;
    #endif // MACHINE_H

  15. #15
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,452
    Quote Originally Posted by LísiasDeCastro
    I am releasing this because I've tried to use database like mysql in c and it is to hard to configure it. So I made it in order to make the life of the programmer easier.
    Before designing and implementing this solution, did you look at SQLite as an example of a well documented, zero configuration database engine implemented in C?
    stahta01 likes this.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Is C++ or C language is a high Level language?
    By uthmankhale in forum C++ Programming
    Replies: 5
    Last Post: 08-25-2011, 06:00 PM
  2. Database to Database Transfer?
    By draggy in forum C++ Programming
    Replies: 4
    Last Post: 01-17-2007, 09:50 AM
  3. What's the Difference Between a Programming Language and a Scripting Language?
    By Krak in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 07-15-2005, 04:46 PM
  4. Computer Language VS Spoken Language
    By Isometric in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 02-04-2002, 02:47 PM
  5. Replies: 1
    Last Post: 10-09-2001, 10:20 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21