How to Load 2 database Togather?

Started by Shovon^, Aug 21, 2016, 03:23 PM

Previous topic - Next topic

Shovon^

How to load 2 database togather?
like:
function onScriptLoad()
{
   pdb <- ConnectSQL("props.sqlite");
   if (pdb) print("Properties Database loaded Successfully");
   ::QuerySQL( pdb, "CREATE TABLE IF NOT EXISTS Properties ( Name TEXT, PX FLOAT, PY FLOAT, PZ FLOAT, Owner VARCHAR(32), Sharer VARCHAR(32), Price NUMERIC, PropertyID INT)" );
LoadProps();
print("Prop creating loaded");

    }


function onScriptUnload()
{
DisconnectSQL( pdb );
}

now how do i give another database in here to loaad togather?
Iam the best and i only believe in Allah

Conatact me here on IRC:  #shovon^ @LUnet

Kewun

function onScriptLoad()
{
   otherdatabase <- ConnectSQL("yourOtherDatabase.sqlite");
   pdb <- ConnectSQL("props.sqlite");
   if ( otherdatabase) print("other database loaded");
   if (pdb) print("Properties Database loaded Successfully");
   ::QuerySQL( otherdatabase, do ur shets here )
   ::QuerySQL( pdb, "CREATE TABLE IF NOT EXISTS Properties ( Name TEXT, PX FLOAT, PY FLOAT, PZ FLOAT, Owner VARCHAR(32), Sharer VARCHAR(32), Price NUMERIC, PropertyID INT)" );
LoadProps();
print("Prop creating loaded");

    }

onscript un load:

add a line
DisconnectSQL( otherdatabase );

Thijn

You shouldn't.

Create multiple tables.

Shovon^

Show me a example plz
add this :function onScriptLoad()
{
   pdb <- ConnectSQL("props.sqlite");
   if (pdb) print("Properties Database loaded Successfully");
   ::QuerySQL( pdb, "CREATE TABLE IF NOT EXISTS Properties ( Name TEXT, PX FLOAT, PY FLOAT, PZ FLOAT, Owner VARCHAR(32), Sharer VARCHAR(32), Price NUMERIC, PropertyID INT)" );
LoadProps();
print("Prop creating loaded");

    }


function onScriptUnload()
{
DisconnectSQL( pdb );
}

with this:
function onScriptLoad()
{
dofile( "scripts/fas_v3_sqlite.nut" );

stats <- array( GetMaxPlayers(), null );
sqliteDB <- ConnectSQL( "database.sqlite" );
}

function onScriptUnload()
{
DisconnectSQL( sqliteDB );
}

this r the scripts plz i want to load them togather...
Iam the best and i only believe in Allah

Conatact me here on IRC:  #shovon^ @LUnet

Thijn

Get the tables from the other database and add them to yours. Use something like an sqlite browser (google it) to export them.

Shovon^

:-\ it would be better if u show a example....... Would u plz??
And I already know  how to load a database.sqlite
Iam the best and i only believe in Allah

Conatact me here on IRC:  #shovon^ @LUnet

KAKAN

db1 <- null;
db2 <- null;
function onScriptLoad(){ db1 = ConnectSQL("sux.my"); db2 = ConnectSQL("my.dix");
QuerySQL(db1,"CREATE TABLE SUX( MI TEXT, DIXLENGTH INT )");
QuerySQL(db2."CREATE TABLE NO( NO TEXT, DOIT INT)");
}
Just an example, it should work.
oh no