Previous Blog Next Blog
Prev/Next Blog
by date

Another Sqlite Blog

Another Sqlite Blog
Name:Frank Carney
Date Posted:Dec 24, 2007
Rating:Not Rated
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for Frank Carney

Blog post
I finally picked up where I left off last September and messed with writing sqlite functions. I made some great strides in figuring out how to copy a table and changing a field name in the process. It is a pain to do, but it was not too bad. Basically I had to use a combination of "pragma" statements to get column information and copy the data except for the rows that do not match. I cannot understand why sqlite would care if I copied data from one row to another of a different name. Either that or it does not understand my intentions. If anyone understands how to copy something like this:

INSERT INTO table2(p,a,b) SELECT c,a,b FROM table1

This code failed with type miss match messages.

How do I get sqlite to copy the data from c to p? I ended up ignoring that field as it is an PRIMARY KEY field. I ended up doing this:

INSERT INTO table2(a,b) SELECT a,b FROM table1

I figured it would generate the necessary values on its own.

I have developed a number of helper functions for creating databases, creating game specific tables, etc. My next step is to actually produce a dynamic mission from this information. Hopefully I can get something working in the next few days. Alas the holidays are upon me and that time may be spoken for.

Also, I uncovered a couple of bugs in the sqliteobject code. I put those changes in the following resource page:
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7281

Merry Christmas everyone!!!
May God bless you.

Recent Blog Posts
List:12/25/07 - Milestone Reached: Mission Launched from Database
12/24/07 - Creating Objects Without Creating Them
12/24/07 - Another Sqlite Blog
09/03/07 - SQLite is Fun!
08/20/07 - Playing House
07/05/07 - Getting burned out and coming back, again...
04/07/07 - Inputs, Inputs everywhere...
04/01/07 - RPG, what does it mean?

Submit ResourceSubmit your own resources!

Frank Carney   (Dec 24, 2007 at 20:48 GMT)
Maybe I am an idiot, but transactions are really cool! It is fault tolerance! I just changed one of my routines to bound the changes to the database in a transaction. I also introduced an error on purpose in one of the queries. It detected the error and rolled back the transactions. This is very cool. Definitely can improve data integrity and prevent the database from getting all hosed up. To think I was manually going back and changing the name of a table every time a query failed during the copy process! I could have bounded it all in a transaction and saved me time during development.

Messing with sqlite definitely is fun. I used to think database stuff was really boring. It is actually very interesting.

You must be a member and be logged in to either append comments or rate this resource.