Posted 12 May 2017 - 02:51 PM
CCDB - Database for Computercraft
[WIP]
I've made a simple little Database which is similar to MySQL.
It's currently work in progress but it's working.
You can use the Database and change it if you want to (but please leave the comment below)
Code: 6BVsxqte
How to use:
Code:
os.loadAPI("database") – or whatever you named it
dbobj = database.database:new( "ip", "username", "password"); – Username, Password and Accesscode without function at the moment
dbobj:tr_command( "COMMAND" ); – function for the commands you see below
dbobj = database.database:new( "ip", "username", "password"); – Username, Password and Accesscode without function at the moment
dbobj:tr_command( "COMMAND" ); – function for the commands you see below
Commands:
CREATE DATABASE dbname
USE dbname
CREATE TABLE tablename (col, col, col, ..)
INSERT tablename (col, col, col, ..) VALUES (val, val, val, ..), (val, val, val, ..), (val, val, val, ..)
SELECT [*]FROM tablename [WHERE col='val']
UPDATE tablename SET col = 'val', col='val', .. WHERE col='val'
DELETE FROM tablename WHERE col='val' [AND is currently bugged]