removed useless _ folders
This commit is contained in:
3
DBMS__Virtual_Machine/DBMS__Virtual_Machine.sol
Normal file
3
DBMS__Virtual_Machine/DBMS__Virtual_Machine.sol
Normal file
@@ -0,0 +1,3 @@
|
||||
<Solution name="DBMS__Virtual_Machine">
|
||||
<Project name="DBMS__Virtual_Machine" path="DBMS__Virtual_Machine\DBMS__Virtual_Machine.prj" active="true"/>
|
||||
</Solution>
|
||||
@@ -0,0 +1,6 @@
|
||||
<Project name="DBMS__Virtual_Machine" guid="D8794FF2-6C00-1014-B904-200204C60A89">
|
||||
<Object name="Object" guid="D87950F2-6C00-1014-B904-200204C60A89">
|
||||
<Script name="DBMS__Virtual_Machine_1.lsl" guid="D8799220-6C00-1014-B904-200204C60A89">
|
||||
</Script>
|
||||
</Object>
|
||||
</Project>
|
||||
@@ -0,0 +1,288 @@
|
||||
// :CATEGORY:Database
|
||||
// :NAME:DBMS__Virtual_Machine
|
||||
// :AUTHOR:Very Keynes
|
||||
// :CREATED:2010-11-18 20:48:39.110
|
||||
// :EDITED:2013-09-18 15:38:51
|
||||
// :ID:224
|
||||
// :NUM:310
|
||||
// :REV:1.0
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// DBMS__Virtual_Machine
|
||||
// :CODE:
|
||||
//Very Keynes - 2008 - 2009
|
||||
|
||||
//
|
||||
|
||||
// Version: OpenSimulator Server 0.6.1.7935 (interface version 2)
|
||||
|
||||
//
|
||||
|
||||
// 2009-01-06, 19:30 GMT
|
||||
|
||||
//
|
||||
|
||||
//------------------Begin VK-DBMS-VM----------------------------\\
|
||||
|
||||
//--------------------Introduction------------------------------\\
|
||||
|
||||
//
|
||||
|
||||
// Very Keynes - DBMS - Virtual Machine
|
||||
|
||||
//
|
||||
|
||||
// Implements a core set of registers and root functions
|
||||
|
||||
// to create and manage multi-table database structures as
|
||||
|
||||
// an LSL list. Although intended to under pin higher level
|
||||
|
||||
// database management tools such as VK-SQL it is usable as
|
||||
|
||||
// a small footprint database facility for system level
|
||||
|
||||
// applications.
|
||||
|
||||
//
|
||||
|
||||
//
|
||||
|
||||
// Naming Conventions and Code Style
|
||||
|
||||
//
|
||||
|
||||
// This Code is intended to be included as a header to user generated
|
||||
|
||||
// code. As such it's naming convention was selected so that it would
|
||||
|
||||
// minimise the possibility of duplicate names in the user code portion
|
||||
|
||||
// of the application. Exposed Functions and Variables are prefixed db.
|
||||
|
||||
//
|
||||
|
||||
// A full User Guide and Tutorial is availible at this URL:
|
||||
|
||||
//
|
||||
|
||||
// http://docs.google.com/Doc?id=d79kx35_26df2pbbd8
|
||||
|
||||
//
|
||||
|
||||
//
|
||||
|
||||
// Table Control Registers
|
||||
|
||||
//
|
||||
|
||||
integer th_; // Table Handle / Index Pointer
|
||||
|
||||
integer tc_; // Columns in Active Table
|
||||
|
||||
integer tr_; // Rows in Active Table
|
||||
|
||||
integer ts_; // Active Table Start Address
|
||||
|
||||
//
|
||||
|
||||
list _d_ = []; // Database File
|
||||
|
||||
list _i_ = [0]; // Index File
|
||||
|
||||
//
|
||||
|
||||
// Exposed Variables
|
||||
|
||||
//
|
||||
|
||||
integer dbIndex; // Active Row Table Pointer
|
||||
|
||||
list dbRow; // User Scratch List
|
||||
|
||||
string dbError; // System Error String
|
||||
|
||||
//
|
||||
|
||||
// Temporary / Working Variables
|
||||
|
||||
//
|
||||
|
||||
integer t_i;
|
||||
|
||||
string t_s;
|
||||
|
||||
float t_f;
|
||||
|
||||
list t_l;
|
||||
|
||||
//
|
||||
|
||||
// System Functions
|
||||
|
||||
//
|
||||
|
||||
string dbCreate(string tab, list col)
|
||||
|
||||
{
|
||||
|
||||
if(dbOpen(tab))
|
||||
|
||||
{
|
||||
|
||||
dbError = tab + " already exists";
|
||||
|
||||
return "";
|
||||
|
||||
}
|
||||
|
||||
tc_ = llGetListLength(col);
|
||||
|
||||
_i_ += [tab, tc_, 0, 0, 0];
|
||||
|
||||
th_= 0;
|
||||
|
||||
dbOpen(tab);
|
||||
|
||||
dbInsert(col);
|
||||
|
||||
return tab;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
integer dbCol(string col)
|
||||
|
||||
{
|
||||
|
||||
return llListFindList(dbGet(0), [_trm(col)]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
integer dbDelete(integer ptr)
|
||||
|
||||
{
|
||||
|
||||
if(ptr > 0 && ptr < tr_)
|
||||
|
||||
{
|
||||
|
||||
t_i = ts_ + tc_ * ptr;
|
||||
|
||||
_d_ = llDeleteSubList(_d_, t_i, t_i + tc_ - 1);
|
||||
|
||||
--tr_;
|
||||
|
||||
return tr_ - 1;
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
dbError = (string)ptr + " is outside the Table Bounds";
|
||||
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
integer dbDrop(string tab)
|
||||
|
||||
{
|
||||
|
||||
t_i = llListFindList(_i_, [tab]);
|
||||
|
||||
if(-1 != t_i)
|
||||
|
||||
{
|
||||
|
||||
dbOpen(tab);
|
||||
|
||||
_d_ = llDeleteSubList(_d_, ts_, ts_ + tc_ * tr_ - 1);
|
||||
|
||||
_i_ = llDeleteSubList(_i_, th_, th_ + 4);
|
||||
|
||||
th_= 0;
|
||||
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
dbError = tab + " : Table name not recognised";
|
||||
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
integer dbExists(list cnd)
|
||||
|
||||
{
|
||||
|
||||
for(dbIndex = tr_ - 1 ; dbIndex > 0 ; --dbIndex)
|
||||
|
||||
{
|
||||
|
||||
if(dbTest(cnd)) return dbIndex;
|
||||
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
list dbGet(integer ptr)
|
||||
|
||||
{
|
||||
|
||||
if(ptr < tr_ && ptr >= 0)
|
||||
|
||||
{
|
||||
|
||||
t_i = ts_ + tc_ * ptr;
|
||||
|
||||
return llList2List(_d_, t_i, t_i + tc_ - 1);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
dbError = (string) ptr + " is outside the Table Bounds";
|
||||
|
||||
return [];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user