Welcome, Guest. Please login or register.

Author Topic: Accessing a DB through C..accomplished..  (Read 791 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline TheMagicMTopic starter

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2857
    • Show only replies by TheMagicM
    • http://www.BartonekDragRacing.com
Accessing a DB through C..accomplished..
« on: January 31, 2005, 12:25:38 AM »
..somewhat.. same concept...

I tried SQLite3 on my linux box..its basically creating a database as a single file..yet it supports a variety of SQL commands..indexes etc.. so I created a silly db just to see if it works..so I modified a example code that opens a the sqlite database, runs a command against it and brings back the result..

SQLite:
http://www.sqlite.org

sample output..

themagicm@linux:~/workspace/test> ./test testdb.db
Usage: ./test DATABASE SQL-STATEMENT
themagicm@linux:~/workspace/test> ./test testdb.db "select * from test;"
name = SideWinder
disk_num = 1
comment = rox
type = G
themagicm@linux:~/workspace/test>

I tried MySQL but am having problems setting it up so I looked around and found this as a good replacement. I'll setup a real db and run some speed tests on it to see how it works under load.
the above url has sample C code that does the above..I used their example and put it in my code to accomplish the above.  (not difficult..pull stuff from example..paste in code..modify to suit needs. LOL)



-Alex
PowerMac G5 dual 2.0ghz/128meg Radeon/500gb HD/2GB RAM, MorphOS 3.9 registered, user #1900
Powerbook G4 5,6 1.67ghz/2gb RAM, Radeon 9700/250gb hd, MorphOS 3.9 registered #3143
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: Accessing a DB through C..accomplished..
« Reply #1 on: January 31, 2005, 12:51:48 PM »
You should just make a web based front end and use php/mysql. It's a doddle :-D
int p; // A
 

Offline TheMagicMTopic starter

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2857
    • Show only replies by TheMagicM
    • http://www.BartonekDragRacing.com
Re: Accessing a DB through C..accomplished..
« Reply #2 on: January 31, 2005, 02:23:16 PM »
yea I know.. since I cant get it working properly (MySQL)..I wanted to try this out to see how it works..
PowerMac G5 dual 2.0ghz/128meg Radeon/500gb HD/2GB RAM, MorphOS 3.9 registered, user #1900
Powerbook G4 5,6 1.67ghz/2gb RAM, Radeon 9700/250gb hd, MorphOS 3.9 registered #3143