Setting up and using a Database
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Setting up and using a Database
My next project will need a database.
Does anyone know where I can find
examples?
In some systems a database is a set
of tables although my experience has
been with systems which called a table
a database.
I'm familiar with SQL so setting up
the database/table is where I need some
help.
Does a database come into existence
by specifying a name (as with files) or
is there another method?
Any help appreciated.
Does anyone know where I can find
examples?
In some systems a database is a set
of tables although my experience has
been with systems which called a table
a database.
I'm familiar with SQL so setting up
the database/table is where I need some
help.
Does a database come into existence
by specifying a name (as with files) or
is there another method?
Any help appreciated.
Life is just a bowl of cherries.
Setting up and using a Database
From the 2.9 docs....
"This topic does not include discussion of how to set
up and create a SQL database, which is beyond the
scope of the Revolution documentation."
No help there so where do I go next?
"This topic does not include discussion of how to set
up and create a SQL database, which is beyond the
scope of the Revolution documentation."
No help there so where do I go next?
Life is just a bowl of cherries.
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
In the case of SQLite, you can create a new database file on your hard drive, automagically, by just "opening" the database. You can then use SQL DDL commands to create the tables.
The above script creates a new sqlite database, and adds a new table Customer with two fields. I made no attempt to define a primary key or index - for more information on the commands for SQLite database schema manipulation, see http://www.sqlite.org.
As for other databases, check their documentation for more information on installation and configuration.
Hope this gets you started,
Jan Schenkel.
Code: Select all
on mouseUp
ask file "Create an SQLite database"
if it is empty then exit mouseUp
put it into tFilePath
put revOpenDatabase("sqlite", tFilePath,,,,) into tConnectionId
put "CREATE TABLE Customer (FirstName, LastName)" into tDDLquery
revExecuteSQL tConnectionId, tDDLquery
revCloseDatabase tConnectionId
end mouseUp
As for other databases, check their documentation for more information on installation and configuration.
Hope this gets you started,
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com
Setting up and using a Database
Jan
I changed one line so that the file
extension is added...
put it & ".db3" into tFilePath
since I'm not in the habit of adding
the extension to new file names.
Of course if I did I'd have .db3.db3.
Do the Rev functions need .db3 to work?
I changed one line so that the file
extension is added...
put it & ".db3" into tFilePath
since I'm not in the habit of adding
the extension to new file names.
Of course if I did I'd have .db3.db3.
Do the Rev functions need .db3 to work?
Life is just a bowl of cherries.
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
The rev functions do not require an extension - the sqlite database driver will check for itself if the file is a valid SQLite database. Of course, it is "cleaner" to add the extension when it's missing.
Jan Schenkel.
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com