Git Product home page Git Product logo

rgss3-extended-database's Introduction

RPG MAKER VX ACE Extended Database

This script will give the vx ace extended external database support.

So it will come with:
  • Basic CRUD
  • Tables with Auto-Increement
  • Advanced search with ==,<=,>=,<,>,!=,*=(is_included?)
  • Sort ASC, DESC
  • Multiple databases
  • ini parser

Examples

# getting version
RGSS3EDB.version

# Create a table
# ---------------------
# First param = tablename
# Second param = table columns
# Third param = primary key have auto increement?
DB.create_table "persons",["id:primary","last_name","first_name","age"],true

# Clear a table
# ---------------------
DB.drop_table "persons"

# Insert a row into a table
# ---------------------
# First param = tablename
# Second param = row content (primary key should have just an empty string)
DB.insert "persons",["","Weiler","Hendrik"]

# Select some rows
# ---------------------
# First param = tablename
# Second param = whether row primary id, hash or "all"
# Third param = optional, you do "column asc" or "column desc" 
# ---------------------
# will return an array of elements
DB.find "persons", {"last_name" => "Weiler"}
# will return the specific element
DB.find "persons", 2
# select multiple ids and returns an array of elements
DB.find "persons", [2,3,6]
# will return an array of elements
DB.find "persons", "all"
# will return an array of elements in descending order
DB.find "persons", {"last_name" => "Weiler"},"last_name desc"
DB.find "persons", {"age" => ">=20"},"last_name desc"
DB.find "persons", {"age" => ">20"},"last_name desc"
DB.find "persons", {"age" => "<=20"},"last_name desc"
DB.find "persons", {"age" => "<20"},"last_name desc"
DB.find "persons", {"last_name" => "!=Weiler"},"last_name desc"
DB.find "persons", {"last_name" => "*=ler"},"last_name desc"

# Editing rows
# ---------------------
myrow = DB.find "persons", 2
myrow.last_name = "Power"
myrow.first_name = "Max"
# use the save method to edit the row
myrow.save
# use the delete method to delete the row
myrow.delete

# Set global variables in rpg maker
myrow = DB.find "persons", 2
# first param : var number, second param: value
DB.set_var 0, myrow.last_name
# Set all column values into global variables in rpg maker
myrow = DB.find "persons", 2
# first param : starting point, second param: result obj
DB.set_var_row 0, myrow
# now variable 0,1,2 are filled with the row values

# using configs class ini parser 
value = DB.get_config "groupname.variable"
value2 = DB.get_config "variable"
# setting configs a new
DB.set_config "variable","some value"

Using multiple databases

# create a database
DB.create_database "some_database_name"

# select that database
DB.set_config "database.selected_db","some_database_name"

# interact with database directly
DB.find "database.table","all"
DB.insert "database.table",["a","b"]
DB.create_table "database.table",[..some colnames..]
DB.table_exists? "database.table"
# ...and so on

Now everything will be will be executed in "some_database_name" database.

Testing

If you want to test the script use the terminal.rb file inside the test directory. The requirement is that you have to have ruby installed.

rgss3-extended-database's People

Contributors

hendrik-weiler avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.