WNOSQL-SAMPLES
================
=================================================================================================
SAMPLE1 : WNOSQL PLSQL
=================================================================================================
SAMPLE-1 :WNOSQL -PLSQL
========================
sample1.wnosql
==============
<WNOSQL> // beginning of wnosql program
<PACK> //load wnosql packages
<USE> CDollar.WDBA; // load cdollar.wdba packages
<USE> WDBA; // load wdba packages
<DATALIB> ps //<DATALIB> is namespace for wnosql plsql
<DATA> // logic syntax
public <CLASS> DATA //<CLASS> means class
{
public void main()
{
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
Char c=' ';
ArrayList ar9= new ArrayList();
ar9.add("EMPLOYEENAME");
ar9.add("SALARY");
ArrayList ar10= new ArrayList();
ar10.add("EMPLOYEENAME");
ar10.add("SALARY");
// create a table using plsql with fields employeename ,salary
WDBASQL.Query("CREATETABLE", "datastoreh", "0", null, 0, "0", "", ar9, "", 0, "", "", c, ar10, t, 1,1);
WDBASQL.Query("CREATETABLE", "datastorehg", "0", null, 0, "0", "", ar9, "", 0, "", "", c, ar10, t, 1,1);
WDBASQL.Query("CREATETABLE", "datastorehgh", "0", null, 0, "0", "", ar9, "", 0, "", "", c, ar10, t, 1,1);
WDBASQL.Query("CREATETABLE", "datastorehghs", "0", null, 0, "0", "", ar9, "", 0, "", "", c, ar10, t, 1,1);
ArrayList ar9s= new ArrayList();
ar9s.add("wilmix78");
ArrayList ar91= new ArrayList();
ar91.add("datastoreh");
ar91.add("datastorehg");
ar91.add("datastorehgh");
ar91.add("datastorehghs");
ArrayList ar911= new ArrayList();
for (int i=1;i<=12000;i++)
ar911.add(i);
//insert the values in batch wise
WDBASQL.Query("INSERTBATCHTABLE", "datastores", "0", null, 0, "0", "", ar91, "", 0, "", "", c, ar911, t, 1,1);
// search 1000 from datastoreh
ArrayList ar7888=WDBASQL.Query("Search", "datastoreh", "0",null, 1200, "1000", "", null, "", 0, "", "", c, null, t, 1,1);
WDBA.writeln(""+ar7888);
//createsavepoint for emp6
WDBASQL.Query("CREATESAVEPOINT", "emp6", "0", null, 0, "", "", null, "", 0, "", "", c, null, t, 7,7);
ArrayList locs = new ArrayList();
locs.add(2);
locs.add(5);
//assume savepoint values 2,5
WDBA.writeln("savepoint="+WDBASQL.Query("SAVEPOINTLOC()", "emp6", "0", null, 0, "", "", locs, "", 0, "", "", c, null, t, 1,1));
// rollback to savepoint
ArrayList locsd = WDBASQL.Query("ROLLBACK()", "emp6", "0", null, 0, "", "", null, "", 0, "", "", c, null, t, 1,1);
WDBA.writeln("los="+locsd);
// commit the transcation
WDBA.writeln("commit="+WDBASQL.Query("COMMIT()", "emp6", "0", null, 0, "", "",null , "", 0, "", "", c, locsd, t, 1,1));
// select from table emp6
ArrayList colsdg =WDBASQL.Query("SelectAll","emp6" ,"0",null,398,"","", null,"",0," ","",c,null,t,1,1);
WDBA.writeln("wil="+colsdg);
ArrayList ar71= new ArrayList();
ar71.add(4);
// increment the value by 4
ArrayList arhg8ey =WDBASQL.Query("SELECTINDEXES","nosd" ,"0",null,0,"4","",ar71,"",0,"","",c,null,t,1,3);
WDBA.writeln("wil="+arhg8ey); WDBA.writeln means it will print it in console
}
}
}
WNOSQL-SAMPLE1-SCREENSHOT
=================================================================================================
SAMPLE-2:WNOSQL: Using C# Program
=================================================================================================
SAMPLE-2
========
SAMPLE-2:WNOSQL: Using C# Program
===================================
program.cs
==========
using System;
using System.Linq;
using System.Text;
using CDollar.WDBA;
using WDBA;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
String s1 = "CREATETABLE from Employee 0 to 0 , 1 to 6 ?= X By 1 1 : {ENO,ENAME,DESIGNATION,SALARY}: {0} :{0}";
// create a table with fields {ENO,ENAME,DESIGNATION,SALARY} for the Employee
Console.WriteLine("" + WDBALIB.WDBAQUERY(s1, t));
String s11 = "SELECTRVAL from Employee 0 to 0 , 1 to 6 ?= X By 1 1 : {0} : {0} :{0}";
// Select the values from EMployee
Console.WriteLine("" + WDBALIB.WDBAQUERY(s11, t));
String s12 = "INSERTINTO from Employee 4 to " + WDBALIB.WDBAQUERY(s11, t).size() + " , 1 to 6 ?= X By 1 1 : {0} : {2,jemin,sse2,300000,3,shyam,mgr,500000} : {0}";
// insert 2 records into Employee table
Console.WriteLine("" + WDBALIB.WDBAQUERY(s12, t));
String s112 = "SELECTRVAL from Employee 0 to 0 , 1 to 6 ?= X By 1 1 : {0} : {0} :{0}";
// Select the values from EMployee
Console.WriteLine("" + WDBALIB.WDBAQUERY(s112, t));
String s171 = "UPDATE from Employee 0 to 0 , 1 to 6 ?= C By 1 1 : {shyam} :{sriram}:{0}";
// change name shyam to sriram
Console.WriteLine("" + WDBALIB.WDBAQUERY(s171, t));
Console.ReadKey();
}
}
}
What will be the output format?
It will create a employee table, list the employee table contents,insert two records into employee table,
list the values of employee table, and after that change the name shyam to sriram
=================================================================================================
SAMPLE-3 : Core JAVA with WNOSQL DB
=================================================================================================
SAMPLE3: Core JAVA with WNOSQL DB
==================================
DBconnection.java
=================
import CDollar.WDBA.*; //import cdollar.wdba packages
import java.io.*;
import Securitydb.*; //import securitydb packages
import jxl.read.biff.BiffException; //import jxl packages
public class DBconnection
{
public static void main(String args[]) throws Exception, BiffException
{
// database tablename datastores, database pwds dbpwds , path
javawdbaconn.javaWDBAQUERY("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
// dbusername and dbpasswords is wilmix78 ,wilmix78 respectively.
javawdbaconn.javaWDBAUSERQUERY("dbuser", "dbpwds", "wilmix78", "wilmix78");
String q="SELECTRVAL from Telecom 3 to 33 , 1 to 7 ?= A By 1 1 : {0} : {0} :{0}"; //list all the table values
javawdbaconn.WDBAQUERY(q); // this statement will call wnosqldbconnection.exe and which gives the output; that //output is written in output.wdba.
System.out.println(""+Secure.RetreiveSecure("output.wdba" ,0));
}
}
What is the output for the following core java program?
It will list the values of Telecom table from 3rd record to 33 record
which is stored in wnosql encrypted shell (1,7).
=======================================================================================
SAMPLE4 : WNOSQL with oakjava7
======================================================================================
SAMPLE4: WNOSQL with OAKJAVA7
==============================
Programs8.web
==============
<WEB> //beginning of oakjava7 program
<USE> <CDOLLARS>.util; //load util packages
<USE> Security; //load security packages
<USE> CDollar.WDBA; // load Cdollar.wdba packages
<USE> WDBA; //load wdba packages
<PACK> Program8
{
<CLASS> Prog
{
public void main()
{
ArrayList arm1= new ArrayList();
arm1.add("sno");
arm1.add("pinno");
arm1.add("randomid");
arm1.add("Amt");
arm1.add("NOT");
<PRINTLN>("<HTML>");
<PRINTLN>("<head> <style>");
<PRINTLN>("table, th, td {");
<PRINTLN>(" border: 1px solid black; ");
<PRINTLN>("}");
<PRINTLN>("</style>");
<PRINTLN>("</head>");
<PRINTLN>("<BODY bgcolor=pink>");
<PRINTLN>("<form>");
ArrayList armg= Request.Query(arm1,"register.cl.dsn",4,1);
string s=armg.get(0).ToString();
<PRINTLN>("<table style='width:100%;' cellpadding=10 cellspacing=5 bgcolor=gold >");
<PRINTLN>("<tr>");
<PRINTLN>(" <p align=center><font size=6 color=blue>ATM TRANSCATION</font></p> ");
<PRINTLN>("</tr>");
<PRINTLN>("<tr>");
<PRINTLN>(" </tr>");
<PRINTLN>(" </tr>");
<PRINTLN>("</table>");
<PRINTLN>("<br>");
<PRINTLN>("<br>");
<PRINTLN>("<br>");
<PRINTLN>("<br>");
<PRINTLN>("<br>");
<PRINTLN>("<br>");
<PRINTLN>("<br>");
<PRINTLN>("<br>");
<PRINTLN>("<br>");
<PRINTLN>("<br>");
<PRINTLN>("<br>");
<PRINTLN>("<br>");
<PRINTLN>("</form>");
<PRINTLN>("</html>");
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
// create a tbale atmtranscation with fields sno,pinno,randomid,amt
String q = "CREATETABLE from atmtranscation 0 to 0 , 1 to 5 ?= 6639 By 6639 f(x) : {SNO,PINNO,Randomid,AMT}: {} :{2,4}";
wdbaconn.WDBAQUERY(q);
Char c= ' ';
///calculate tablesize() of atmtranscation
ArrayList datas1=WDBASQL.Query("TABLESIZE()","atmtranscation","0",null,4,"","", null,"",0,"","",c,null,t,1,5);
String t1="";
t1=armg.get(0).ToString()+","+armg.get(1).ToString()+","+armg.get(2).ToString()+","+armg.get(3).ToString();
String s12 ="INSERTINTO from atmtranscation 0 to "+datas1.size()+" , 1 to 5 ?= A By 1 1 : {0} : {"+t1+"} : {0}";
wdbaconn.WDBAQUERY(s12);
<PRINTLN>(" </table>");
<PRINTLN>(" </form>");
<PRINTLN>(" </html>");
}
}
}
What is the Output for the following OAKJAVA7(java7)-JDollar Program?
a) At first it will create a table with 4 fields sno,pinno,randomid,amt
b) we must compute the table size of the atmtranscation table..
c) get the value from 4 fields using armg.get(0).ToString()
d) After that insert into table atmtranscation 0 to datas1.size()
so if the table rows contains 4 values ie) no row is inserted in the table
but first row is considered as table fields ; so datas1.size() will return only
value as 4.
ie) INSERTINTO from atmtranscation 0 to 4 at wnosql-shell(1,5)
t= "111", "222","-222222", "30000"; // this values you will get from form
when the form post the data.
so value [ "111","222","-222222","30000" ] is inserted into atmtranscation table...
so in this way we can insert n values...
================================================================================================
SAMPLE -5 : WNOSQL Manipulation with C#
==========
=================================================================================================
Sample-5: Write a C# program using WNOSQL securable database to
a) ADD b) UPDATE c) SELECTALL d) DELETE e) SEARCH f) FIND
g) NEXT RECORD.
C# Program
==========
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using CDollar.WDBA;
using WDBA;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
static String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
private void Form1_Load(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
String s1 = "CREATETABLE from Employee1 0 to 0 , 1 to 6 ?= X By 1 1 : {ENO,ENAME,DESIGNATION,SALARY}: {0} :{0}";
String s11 = "SELECTRVAL from Employee1 0 to 0 , 1 to 6 ?= X By 1 1 : {0} : {0} :{0}";
// Select the values from EMployee
Console.WriteLine("" + WDBALIB.WDBAQUERY(s11, t));
String tx = textBox1.Text + "," + textBox2.Text + "," + textBox3.Text + "," + textBox4.Text;
String s12 = "INSERTINTO from Employee1 4 to " + WDBALIB.WDBAQUERY(s11, t).size() + " , 1 to 6 ?= X By 1 1 : {0} : {"+tx+"} : {0}";
// insert 2 records into Employee table
MessageBox.Show("" + WDBALIB.WDBAQUERY(s12, t));
}
private void button2_Click(object sender, EventArgs e)
{
String data = textBox2.Text;
String data1 = textBox5.Text;
String s171 = "UPDATE from Employee1 0 to 0 , 1 to 6 ?= C By 1 1 : {"+data+"} :{"+data1+"}:{0}";
// change name shyam to sriram
Console.WriteLine("" + WDBALIB.WDBAQUERY(s171, t));
}
private void button3_Click(object sender, EventArgs e)
{
String s11 = "SELECTRVAL from Employee1 0 to 0 , 1 to 6 ?= X By 1 1 : {0} : {0} :{0}";
// Select the values from EMployee
MessageBox.Show("lIST=" + WDBALIB.WDBAQUERY(s11, t));
}
private void button4_Click(object sender, EventArgs e)
{
String data1 = textBox5.Text;
String s45 = "DELETE from Employee1 0 to 0 , 1 to 6 ?= X By 1 1 : {"+data1+"} :{0} :{0}";
MessageBox.Show("DELETED" + WDBALIB.WDBAQUERY(s45, t));
}
private void button5_Click(object sender, EventArgs e)
{
String ds1 = textBox5.Text.Trim();
String s11 = "SELECTRVAL from Employee1 0 to 0 , 1 to 6 ?= X By 1 1 : {0} : {0} :{0}";
// Select the values from EMployee
int size = Convert.ToInt32(WDBALIB.WDBAQUERY(s11, t).size())-1;
try
{
String ds = "Search from Employee1 4 to "+size+" , 1 to 6 ?= "+ds1+" By 1 1 : {0} : {0} :{0}";
MessageBox.Show("Presentornot=" + WDBALIB.WDBAQUERY(ds, t));
}
catch (Exception e1) { Console.WriteLine("" + e1); }
}
private void button6_Click(object sender, EventArgs e)
{
String ds1 = textBox5.Text.Trim();
String s11 = "SELECTRVAL from Employee1 0 to 0 , 1 to 6 ?= X By 1 1 : {0} : {0} :{0}";
// Select the values from EMployee
int size = Convert.ToInt32(WDBALIB.WDBAQUERY(s11, t).size()) - 1;
// Search from Tablename index1 to indexn, row to col ?= Character By X X: { 0} : { 0} :{ 0}
try
{
// String ds = "Search from Employee1 4 to 8 , 1 to 6 ?= 11 By 1 1 : {0} : {0} :{0}";
String ds = "Search from Employee1 4 to " + size + " , 1 to 6 ?= " + ds1 + " By 1 1 : {0} : {0} :{0}";
int pos = 0;
for (int i = 0; i <= WDBALIB.WDBAQUERY(ds, t).size()-1; i++)
{
if ( WDBALIB.WDBAQUERY(ds, t).get(i).ToString().Equals(ds1))
{
pos = i;
}
}
textBox1.Text = WDBALIB.WDBAQUERY(ds, t).get(pos).ToString();
textBox2.Text = WDBALIB.WDBAQUERY(ds, t).get(pos+1).ToString();
textBox3.Text = WDBALIB.WDBAQUERY(ds, t).get(pos+2).ToString();
textBox4.Text = WDBALIB.WDBAQUERY(ds, t).get(pos+3).ToString();
}
catch (Exception e1) { Console.WriteLine("" + e1); }
}
static int pos = 0;
private void button7_Click(object sender, EventArgs e)
{
String s11 = "SELECTRVAL from Employee1 0 to 0 , 1 to 6 ?= X By 1 1 : {0} : {0} :{0}";
// Select the values from EMployee
int size = Convert.ToInt32(WDBALIB.WDBAQUERY(s11, t).size()) - 1;
try
{
String ds = "SelectRange from Employee1 5 to " + size + " , 1 to 6 ?= C By 1 1 : {0} : {0} :{0}";
{
textBox1.Text = WDBALIB.WDBAQUERY(ds, t).get(pos).ToString();
textBox2.Text = WDBALIB.WDBAQUERY(ds, t).get(pos + 1).ToString();
textBox3.Text = WDBALIB.WDBAQUERY(ds, t).get(pos + 2).ToString();
textBox4.Text = WDBALIB.WDBAQUERY(ds, t).get(pos + 3).ToString();
}
pos += 4;
}
catch (Exception e1) { Console.WriteLine("" + e1); }
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void button8_Click(object sender, EventArgs e)
{
String s11 = "SELECTRVAL from Employee1 0 to 0 , 1 to 6 ?= X By 1 1 : {0} : {0} :{0}";
// Select the values from EMployee
int size = Convert.ToInt32(WDBALIB.WDBAQUERY(s11, t).size()) - 1;
try
{
String ds = "SelectRange from Employee1 4 to " + size + " , 1 to 6 ?= C By 1 1 : {0} : {0} :{0}";
string[] row = null;
String s111 = WDBALIB.WDBAQUERY(ds, t).toString();
String s1 = ""; String s2 = ""; String s3 = ""; String s4 = "";
for (int i = 1; i <= size ; i += 4)
{
s1 = WDBALIB.WDBAQUERY(ds, t).get(i).ToString();
s2 = WDBALIB.WDBAQUERY(ds, t).get(i + 1).ToString();
s3 = WDBALIB.WDBAQUERY(ds, t).get(i + 2).ToString();
s4 = WDBALIB.WDBAQUERY(ds, t).get(i + 3).ToString();
row = new string[] { s1, s2, s3, s4 };
dataGridView1.Rows.Add(row);
}
}
catch (Exception e1) { Console.WriteLine("" + e1); }
}
}
}
OUTPUT
=======
===========================================================================
SAMPLE -6: Create Table and intialize the value to be inserted in
Telecom Table.
===========================================================================
Program-1:WNOSQL
=================
example1.WNOSQL
================
<WNOSQL> //starting of wnosql or WDBA program
<PACK> // import all wdba packages
<USE> CDollar.WDBA; // load Cdollar.wdba packages
<USE> WDBA; //load wdba packages
<DATALIB> ps
<DATA>
public <CLASS> DATA
{
public void main()
{
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\Wcod");
// let database name me datastores , database pwd be dbpwds and the path be C:\\Pr ograms\\WNOSQL\\WNOSQLProgramfiles\\Wcod
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
//pass dbuser and dbpwds as wilmix78 ,wilmix78
String s1 = "CREATETABLE from Telecom 0 to 0 , 1 to 7 ?= 6639 By 6639 f(x) :
{SNO,CLASS,CHILDS}:
{1,A,a1,2,A,a2,3,A,a3,4,B,b1,5,B,b2,6,B,b3,7,C,c1,8,C,c2,9,C,c3} :{2,4}";
//create a table Telecom with fields SNO,CLASS,CHILDS... and set rows = 1 and cols
= 7
//and intialize the value {1,A,a1,2,A,a2,3,A,a3,4,B,b1,5,B,b2,6,B,b3,7,C,c1,8,C,c2,9,C,c3} =
> total values =30
//here 1 indicates SNO, A indicates CLASS , and ,CHILD indicates a1 and so -on .
ArrayList ar= WDBALIB.WDBAQUERY(s1, t); // now pass the query in the WDBAQUERY api
// so what happens this statement will execute the query and create a table
//and it will insert the values in the table Telecom.
}
}
}
===========================================================================
SAMPLE-7 : List the values from Telecom table
===========================================================================
Program-2:WNOSQL
================
example2.WNOSQL
================
<WNOSQL>
<PACK>
<USE> CDollar.WDBA;
<USE> WDBA;
<DATALIB> ps
<DATA>
public <CLASS> DATA
{
public void main()
{
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNO");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
String s1 ="SELECTRVAL from Telecom 3 to 30 , 1 to 7 ?= C By 1 1 : {0} : {0} :{1}";
// At first omit 3 fields and start from 3.
//select all row values from table Telecom from 3 to 30 ArrayList ar= WDBALIB.WDBAQUERY(s1, t);
//now when you execute the query it displays all the row values..
}
}
}
===========================================================================
SAMPLE-8 : List the values from Telecom table and Delete a Particular value
and List the System Date.
===========================================================================
Program-2 :WNOSQL
=================
example3.WNOSQL
================
<WNOSQL>
<PACK>
<USE> CDollar.WDBA;
<USE> WDBA;
<DATALIB> ps
<DATA>
public <CLASS> DATA
{
public void main()
{
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
String s11 ="SELECTRVAL from Telecom 3 to 33 , 1 to 7 ?= C By 1 1 : {0} : {0} :{1}";
String s1 ="DELETE from Telecom 3 to "+WDBALIB.WDBAQUERY(s11, t).size() +" , 1 to 7 ?= A By 0 0 : {a1} : {xx}: {XX}";
ArrayList arf= WDBALIB.WDBAQUERY(s1, t);
// delete the value from rows with string a1
String s16 ="SYSDATE from Telecom 3 to "+WDBALIB.WDBAQUERY(s11, t).size() +" , 1 to 7 ?= A By 0 0 : {a1} : {xx}: {XX}";
ArrayList arfh= WDBALIB.WDBAQUERY(s16, t);
//compute sysdate for the Telecom
}
}
}
===========================================================================
SAMPLE-9 : List the values from Telecom table and insert a rows in to the Telecom Table
===========================================================================
Program3 : WNOSQL
=================
example4.WNOSQL
================
<WNOSQL>
<PACK>
<USE> CDollar.WDBA;
<USE> WDBA;
<DATALIB> ps
<DATA>
public <CLASS> DATA
{
public void main()
{
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
String s11 ="SELECTRVAL from Telecom 3 to 33 , 1 to 7 ?= A By 1 1 : {0} : {Telecom}
:{0}";
ArrayList ar1= WDBALIB.WDBAQUERY(s11, t);
//compute the size of Telecom table inorder to insert the values (1,A,a1) after that
//so we will choose the second section for values insertion.and thus we insert a row
//into Telecom table.
String s1 ="INSERTINTO from Telecom 3 to "+ar1.size() +" , 1 to 7 ?= A By 1 1 : {0} : {1,A,a1} :
{0}";
ArrayList ar= WDBALIB.WDBAQUERY(s1, t);
//execute the query
}
}
}
===========================================================================
SAMPLE-10 : List the values from Table Telecom based on a Matched character
===========================================================================
Program4: WNOSQL
================
example5.WNOSQL
================
<WNOSQL>
<PACK>
<USE> CDollar.WDBA;
<USE> WDBA;
<DATALIB> ps
<DATA>
public <CLASS> DATA
{
public void main()
{
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
String s1 ="MATCH from Telecom 3 to 29 , 1 to 7 ?= C 0001 1 1 : {0} : {0} :{0}";
// we are choosing values starting from 3 to 29
// and perform match operations and test what rows are matched by char C
WDBA.writeln(""+WDBALIB.WDBAQUERY( s1, t));
}
}
}
Output:
=======
Telecom table contents :
[SNO CLASS CHILDS 1 A XXX5 2 A a2 3 A a3 4 B b1 5 B b2 6 B b3 7 C c1 8 C c2 9 C c3]
MATCHED ROWS
[22, 23, 25, 26, 28, 29]
for eg)
22 indicates 7 after that C character succeed and ends
so 22 23 will be taken into account.
simillarly so-on.
===========================================================================
SAMPLE-11 : Use of SelectIn clause and use of TableSize()
===========================================================================
Use of SelectIn clause and use of TableSize()
Program5.wnosql
<WNOSQL>
<PACK>
<USE> CDollar.WDBA;
<USE> WDBA;
<DATALIB> ps
<DATA>
public <CLASS> DATA
{
public void main()
{
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
// SelectIn clause is used to check Character 'C' or not and display the character in the arraylist format as 3 times ; since it occured 3 times.
String s100 ="SelectIN from Telecom 3 to 29 , 1 to 7 ?= C By 1 1 : {0} : {0} :{0}";
WDBA.writeln(""+WDBALIB.WDBAQUERY( s100, t));
char c=' ';
//Calculate size of the table using TABLESIZE()
ArrayList datas1=WDBASQL.Query("TABLESIZE()","Telecom","0",null,19,"","", null,"",0,"","",c,null,t,1,7);
WDBA.writeln(""+datas1.size());
}
}
}
Output:
=======
[C, C, C]
36
===========================================================================
SAMPLE-12: Use of SELECTROWS, SelectAssign and Count(*) in Wnosql Query
===========================================================================
Program12.wnosql
==================
<WNOSQL>
<PACK>
<USE> CDollar.WDBA;
<USE> WDBA;
<DATALIB> ps
<DATA>
public <CLASS> DATA
{
public void main()
{
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
// It is used to assign the value 124 ie) that can be done by ?= 124 in SelectAssign Query
String s124177j ="SelectAssign from Telecom 3 to 29 , 1 to 7 ?= 124 By 1 1 :{0,3,4,6,7,8} :{0}:{0}";
WDBA.writeln("datas41j"+WDBALIB.WDBAQUERY( s124177j, t));
//SelectRows is used to list the Assigned Row value ie) 124 in 0 location ie) 124=0
String s1187 ="SELECTROWS from Telecom 3 to 33 , 1 to 7 ?= C By 1 1 : {0} : {0} :{0}";
WDBA.writeln("SELECTROWS="+WDBALIB.WDBAQUERY( s1187, t));
// Count(*) is used to list no of rows in table tablename1.
String s300 ="Count(*) from Telecom 3 to 29 , 1 to 7 ?= C By 1 1 : {0} : {0} :{0}";
WDBA.writeln(""+WDBALIB.WDBAQUERY( s300, t));
}
}
}
Output
=======
datas41j[Assigned values] Listing Table Telecom contents ... IP=1 ------------- {124=0} | -------------------------- {124=[0]} |
[[{124=0}]]
[2]
==========================================================================
SAMPLE-13: Use of Select, Search and SelectIN in Wnosql Query
==========================================================================
Use of Select ,Search ,SelectIN in wnosql Query:-
sample13.wnosql
<WNOSQL>
<PACK>
<USE> CDollar.WDBA;
<USE> WDBA;
<DATALIB> ps
<DATA>
public <CLASS> DATA
{
public void main()
{
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
String s1 = "CREATETABLE from Telecom 0 to 0 , 1 to 7 ?= 6639 By 6639 f(x) : {SNO,CLASS,CHILDS}: {1,A,a1,2,A,a2,3,A,a3,4,B,b1,5,B,b2,6,B,b3,7,C,c1,8,C,c2,9,C,c3} :{2,4}";
ArrayList ar= WDBALIB.WDBAQUERY(s1, t);
// Select Query will display the 29th value from the Given table Telecom.
String s1j ="Select from Telecom 3 to 29 , 1 to 7 ?= A 0001 1 1 : {0} : {0} :{0}";
WDBA.writeln("Select="+WDBALIB.WDBAQUERY( s1j, t));
// Search Query will display in Arraylist format when the given character A is found
String s1j2 ="Search from Telecom 3 to 29 , 1 to 7 ?= A 0001 1 1 : {0} : {0} :{0}";
WDBA.writeln("Search="+WDBALIB.WDBAQUERY( s1j2, t));
// SelectIN Query will display in Arraylist format when the given character C is found;
//then display the Character by it's occurrence eg) C is displayed in
// arraylist as 3 times
String s100 ="SelectIN from Telecom 3 to 29 , 1 to 7 ?= C By 1 1 : {0} : {0} :{0}";
WDBA.writeln("SelectIN"+WDBALIB.WDBAQUERY( s100, t));
}
}
}
Output:
Select=[c3]
Search=[1, A, a1, 2, A, a2, 3, A, a3, 4, B, b1, 5, B, b2, 6, B, b3, 7, C, c1, 8, C, c2, 9, C, c3]
SelectIN[C, C, C]
===========================================================================
SAMPLE-14 : Use of SelectOrderByDESC,SelectOrderByASC,SelectIntOrderByAsc,SelectIntOrderByDesc,
SelectAll,Search,SearchGT,SelectRange.
===========================================================================
Example6.wnosql
===============
<WNOSQL>
<PACK>
<USE> CDollar.WDBA;
<USE> WDBA;
<DATALIB> ps
<DATA>
public <CLASS> DATA
{
public void main()
{
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
// List the data from table Telecom in DescenDing order
String s11 ="SelectOrderByDESC from Telecom 1 to 20 , 1 to 7 ?= C By 1 1 : {0} : {0} :{0}";
WDBA.writeln("DESC="+WDBALIB.WDBAQUERY( s11, t));
// List the data from table Telecom in AscenDing order
String s1 ="SelectOrderByASC from Telecom 1 to 20 , 1 to 7 ?= A1 By 1 1 : {0} : {0} :{0}";
WDBA.writeln("ASC="+WDBALIB.WDBAQUERY( s1, t));
// we know by definition this statement order the table contents containing integer nos in Ascending order.
String s12 ="SelectIntOrderByAsc from datastoreh 50 to 2000 , 1 to 1 ?= 123 By 1 1 : {0} : {0} :{0}";
WDBA.writeln("ASC="+WDBALIB.WDBAQUERY( s12, t));
// we know by definition this statement order the table contents containing integer nos in Descending order.
String s121 ="SelectIntOrderByDesc from datastoreh 50 to 2000 , 1 to 1 ?= 123 By 1 1 : {0} : {0} :{0}";
WDBA.writeln("DESC="+WDBALIB.WDBAQUERY( s121, t));
// we know by definition this statement will list all the table values from 50 to 2000
String s1217 ="SelectAll from datastoreh 50 to 2000 , 1 to 1 ?= 123 By 1 1 : {0} : {0} :{0}";
WDBA.writeln("datas"+WDBALIB.WDBAQUERY( s1217, t));
//Search is used to list a arraylist value when given Character or a number is found from Tablename by given rows and cols.
String s121777 ="Search from datastoreh 50 to 200 , 1 to 1 ?= 110 By 1 1 : {0} : {0} :{0}";
WDBA.writeln("datas11"+WDBALIB.WDBAQUERY( s121777, t));
//SearchGT is used to list the values which is greater than a Searchednumber from the Tablename by given rows and cols.
String s121377 ="SearchGT from datastoreh 50 to 200 , 1 to 1 ?= 100 By 1 1 : {0} : {0} :{0}";
WDBA.writeln("datas51"+WDBALIB.WDBAQUERY( s121377, t));
//SelectRange is used to list the values according to given indexranges( index range1 to index rangen ) from the Tablename by given rows and cols.
String s124177 ="SelectRange from datastoreh 50 to 2000 , 1 to 1 ?= 1000 By 1 1 : {0} : {0} :{0}";
WDBA.writeln("datas41"+WDBALIB.WDBAQUERY( s124177, t));
}
}
}
Output:
=======
It display more data so you can see the wnosqltutorial.pdf for your Wnosql db reference.
===========================================================================
SAMPLE-15: Use of Encrypt and Decrypt
===========================================================================
encrypt.wnosql
==============
<WNOSQL>
<PACK>
<USE> CDollar.WDBA;
<USE> WDBA;
<DATALIB> ps
<DATA>
public <CLASS> DATA
{
public void main()
{
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
char c=' ';
//use to encrypt the TABLE telecom; if you encrypt the table no body can't read your table data
String s4 ="Encrypt from Telecom 3 to 29 , 1 to 7 ?= C By 1 1 : {0} : {0} :{0}";
WDBA.writeln(""+WDBALIB.WDBAQUERY( s4, t));
//use to Decrypt the TABLE telecom
String s5 ="Decrypt from Telecom 3 to 29 , 1 to 7 ?= C By 1 1 : {0} : {0} :{0}";
WDBA.writeln(""+WDBALIB.WDBAQUERY( s5, t));
// List the values from the table Telecom which is decrypted.
String q="SELECTRVAL from Telecom 3 to 33 , 1 to 7 ?= A By 1 1 : {0} : {0} :{0}";
WDBA.writeln(""+WDBALIB.WDBAQUERY( q, t).get(0));
}
}
}
OUTPUT:
========
[] [] []
[SNO CLASS CHILDS 1 A a1 2 A a2 3 A a3 4 B b1 5 B b2 6 B b3 7 C c1 8 C c2 9 C c3]
===========================================================================
SAMPLE -16: Use of RightJoin and INNERJOIN
===========================================================================
sample16.wnosql
================
<WNOSQL>
<PACK>
<USE> CDollar.WDBA;
<USE> WDBA;
<DATALIB> ps
<DATA>
public <CLASS> DATA
{
public void main()
{
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
char c=' ';
WDBA.writeln("");
//If we use the right join to combine two different tables, then we will get all the records from the right table. //But we will get only those records from the left table, which have the corresponding key in the right table. //Rest other records in the left table for which the common column value doesn't match with the common //column value of the right table; displayed as NULL.
String s12 ="RIGHTJOIN from Telecom 3 to 29 , 1 to 7 ?= Telecom By 1 1 : {1,2,3} : {4,5,6} :{1,2,3}";
WDBA.writeln("RIGHTJOIN="+WDBALIB.WDBAQUERY( s12, t));
WDBA.writeln("");
//InnerJoin means the intersection between two tables. ie) the common rows.
String s114 ="INNERJOIN from Telecom 3 to 29 , 1 to 7 ?= Telecom By 1 1 : {1,2,3} : {1,2,3} :{1,2,3}";
WDBA.writeln("INNERJOIN="+WDBALIB.WDBAQUERY( s114, t));
}
}
}
Output:
========
RIGHTJOIN=[ CLASS, A, CHILDS, a1, 1, 2]
INNERJOIN=[ CLASS, CHILDS, 1]
=================================================================================================
SAMPLE -17 : Use of Create a table,AVG,MIN,SUM,Select Cols,DISTINCT
=================================================================================================
sample17.wnosql
<WNOSQL>
<PACK>
<USE> CDollar.WDBA;
<USE> WDBA;
<DATALIB> ps
<DATA>
public <CLASS> DATA
{
public void main()
{
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
char c=' ';
//Create a table AGG
String s1 = "CREATETABLE from AGG 0 to 0 , 1 to 7 ?= 6639 By 6639 f(x) : {1,2,3}: {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,23,24,25,26,27} :{2,4}";
ArrayList ar= WDBALIB.WDBAQUERY(s1, t);
// Average of indexes 1,1,1,1 values in table AGG ; the total no of
// values present in a table is 1000. ie) we give in query is 5 to 1000.
//SUM value of indexes 1,1,1,1, is 8
// ie) 8/1000=0.008
String s390 ="AVG() from AGG 5 to 1000 , 1 to 7 ?= 3001 By 1 1 : {1,1,1,1} : {0} :{0}";
WDBA.writeln("datacountAVG="+WDBALIB.WDBAQUERY( s390, t));
// MIN of indexes 5,6,8,9 values in table AGG
String s3909 ="MIN() from AGG 5 to 1000 , 1 to 7 ?= 3001 By 1 1 : {5,6,8,9} : {0} :{0}";
WDBA.writeln("datacountMIN="+WDBALIB.WDBAQUERY( s3909, t));
// SUM of indexes 0,1,2,3 values in table AGG
String s39068 ="SUM() from AGG 5 to 1000 , 1 to 7 ?= 3001 By 1 1 : {0,1,2,3} : {0} :{0}";
WDBA.writeln("datacountSUM="+WDBALIB.WDBAQUERY( s39068, t));
//It is used to list the column values according to column indexes.
String s2 ="SelectCols from datastorehg 0 to 1000 , 1 to 1 ?= C By 1 1 : {3,4,5,6,7,8} : {0} :{0}";
WDBA.writeln("cols="+WDBALIB.WDBAQUERY( s2, t));
//It is used to remove duplicate column values according to column indexes
String s4 ="DISTINCT from datastorehg 0 to 1000 , 1 to 1 ?= C By 1 1 : {0,0,1,1,5,5} : {0} :{0}";
WDBA.writeln("Distinct="+WDBALIB.WDBAQUERY( s4, t));
}
}
}
Output:
=======
datacountAVG=[0.008]
datacountMIN=[3.0]
datacountSUM=[7.0]
cols=[ 4333, 5544, 5455, 54544, 66565, 6565]
Distinct=[ 4344, 5455, 267]
===========================================================================
SAMPLE-18 :Use of CLUSTER,CLUSTERPROPERTY,BACKUPCLUSTER
==========================================================================
sample18.wnosql
<WNOSQL>
<PACK>
<USE> CDollar.WDBA;
<USE> WDBA;
<DATALIB> ps
<DATA>
public <CLASS> DATA
{
public void main()
{
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds","F:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
char c=' ';
// To Store CLUSTER of Data from a given range to be encrypted and retrieve from encrypted file...
// so we are storing the data to be protected in this case CLUSTER is used
// values of Telecom table , will be inserted to AGG21 table.
// when you apply the Query CLUSTER and run the program
// AGG22.cluster.wdba is created where .wdba files are stored in a directory.
String s1gc ="SELECTRVAL from Telecom 0 to 9 , 1 to 7 ?= C By 1 1 : {0} : {0} :{1}";
ArrayList arjkkc= WDBALIB.WDBAQUERY(s1gc, t);
String s1tabhj = "CLUSTER from AGG21 0 to 9 , 1 to 7 ?= x By 1 f(x) : {"+arjkkc.ToString()+"}: {0} :{0}";
ArrayList artabhj= WDBALIB.WDBAQUERY(s1tabhj, t);
WDBA.writeln("ans15="+artabhj);
//To compute clustertable size, display data, display system date, Display remaning space //available to store values in a cluster table.
String s1tabhj1 = "CLUSTERPROPERTY from AGG21 0 to 9 , 1 to 7 ?= x By 1 f(x) : {"+arjkkc.ToString()+"}: {0} :{0}";
ArrayList artabhj1= WDBALIB.WDBAQUERY(s1tabhj1, t);
WDBA.writeln("ans15="+artabhj1);
//after that now delete the file AGG21.wdba and Execute BACKUPCLUSTER query
//TO RESTORE the Lost CLUSTER DATA(AGG21.wdba) and automatically store the contents //in a table.
String s1tabhj1f = "BACKUPCLUSTER from AGG21 0 to 27 , 1 to 7 ?= x By 1 f(x) : {"+arjkkc.ToString()+"}: {0} :{0}";
ArrayList artabhj11= WDBALIB.WDBAQUERY(s1tabhj1f, t);
WDBA.writeln("ans151="+artabhj11);
// after BACKUPCLUSTER you can retrieve data using SELECTRVAL statements.
String s1g ="SELECTRVAL from AGG21.cluster 0 to 9 , 1 to 7 ?= C By 1 1 : {0} : {0} :{1}";
ArrayList arjkk= WDBALIB.WDBAQUERY(s1g, t);
WDBA.writeln("ans151j="+arjkk.ToString().Replace("[","").Replace("]","").Replace("{","").Replace("}",""));
}
}
}
Output
======
[SNO CLASS CHILDS 1 A a1 2 A a2 3 A a3 4 B b1 5 B b2 6 B b3 7 C c1 8 C c2 9 C c3]
converting to class file is completed successfully.
CLUSTER
=======
ans15=[[0=SNO, CLASS, CHILDS, 1, A, a1, 2, A, a2]]
CLUSTERPROPERTY
==================
ans15=[CLUSTER SIZE=9, CLUSTER DATA=[{0=SNO, CLASS, CHILDS, 1, A, a1, 2, A, a2], SYSTEM DATE=Sat Aug 01 17:58:33 IST 2020, WNOSQL(*) CLUSTER SPACE AVAILABLE=2991]
converting to class file is completed successfully.
BACKUPCLUSTER
==============
ans151=[[0=SNO, CLASS, CHILDS, 1, A, a1, 2, A, a2, 3, A, a3, 4, B, b1, 5, B, b2, 6, B, b3, 7, C, c1, 8, C, c2]]
{0=[[SNO CLASS CHILDS 1 A a1 2 A a2 3 A a3 4 B b1 5 B b2 6 B b3 7 C c1 8 C c2 9 C c3]]}
ans151j=0=SNO, CLASS, CHILDS, 1, A, a1, 2, A, a2, 3, A, a3, 4, B, b1, 5, B, b2, 6, B, b3, 7, C, c1, 8, C, c2, 9, C, c3
===========================================================================
SAMPLE-19 : USE of SelectUPPER , SelectLOWER
===========================================================================
sample10.wnosql
=================
<WNOSQL>
<PACK>
<USE> CDollar.WDBA;
<USE> WDBA;
<DATALIB> ps
<DATA>
public <CLASS> DATA
{
public void main()
{
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
//It is used to list the values from TableName in Uppercase by given rows and cols.
String s232 ="SelectUPPER from Telecom 3 to 29 , 1 to 7 ?= X By 1 1 : {0} : {0} :{0}";
WDBA.writeln("upper"+WDBALIB.WDBAQUERY( s232, t));
//It is used to list the values from TableName in Lowercase by given rows and cols.
String s2321 ="SelectLOWER from Telecom 3 to 29 , 1 to 7 ?= X By 1 1 : {0} : {0} :{0}";
WDBA.writeln("lower"+WDBALIB.WDBAQUERY( s2321, t));
}
}
}
OUTPUT:
=======
upper[1, A, A1, 2, A, A2, 3, A, A3, 4, B, B1, 5, B, B2, 6, B, B3, 7, C, C1, 8, C, C2, 9, C, C3]
lower[1, a, a1, 2, a, a2, 3, a, a3, 4, b, b1, 5, b, b2, 6, b, b3, 7, c, c1, 8, c, c2, 9, c, c3]
=================================================================================================
Sample 20: Use of SelectC* and SelectR*
=================================================================================================
example20.wnosql
=================
<WNOSQL>
<PACK>
<USE> CDollar.WDBA;
<USE> WDBA;
<DATALIB> ps
<DATA>
public <CLASS> DATA
{
public void main()
{
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
//It is used to Count no of columns present in the table
String s23l01 ="SELECTC* from AGG 0 to 0 , 1 to 7 ?= X By 1 1 : {0} : {0} : {0}";
WDBA.writeln("Selectc*="+WDBALIB.WDBAQUERY( s23l01, t));
//To compute how many rows in field table use SELECTR*
String s23l02 ="SELECTR* from AGG 0 to 0 , 1 to 7 ?= X By 1 1 : {0} : {0} : {0}";
WDBA.writeln("selectr*="+WDBALIB.WDBAQUERY( s23l02, t));
}
}
}
OUTPUT
======
Selectc*=[3]
selectr*=[9]
=================================================================================================
SAMPLE 21: Use of SelectLike ,LOC(),Count(),Primarykey,Foreignkey
=================================================================================================
sample21.wnosql
<WNOSQL>
<PACK>
<USE> CDollar.WDBA;
<USE> WDBA;
<DATALIB> ps
<DATA>
public <CLASS> DATA
{
public void main()
{
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
Char c=' ';
String s23l025 ="SELECTRVAL from Telecom 0 to 33 , 1 to 7 ?= X By 1 1 : {0} : {0} :{0}";
WDBA.writeln("ans5="+WDBALIB.WDBAQUERY( s23l025, t));
//Display all telecom data with B
String s23l ="SelectLike from Telecom 0 to 27 , 1 to 7 ?= B By 1 1 : {0} : {0} :{0}";
WDBA.writeln("ans1="+WDBALIB.WDBAQUERY( s23l, t));
//Loc is used to find the given data stored in a location in a table.LOC()
//will list the location in arraylist format.
String s23l0256d ="LOC() from Telecom 0 to 29 , 1 to 7 ?= B By 1 1 : {0} : {0} :{0}";
WDBA.writeln("ans6="+WDBALIB.WDBAQUERY( s23l0256d, t));
// to count the occurance of data with in a given range startingindex and endingindex from the table.
String s17787 ="Count() from Telecom 0 to 29 , 1 to 7 ?= C By 1 1 : {0} :{0}:{0}";
ArrayList ar12o= WDBALIB.WDBAQUERY(s17787, t);
WDBA.writeln("ans12="+ar12o);
String s23l0251 ="SELECTRVAL from Telecom 0 to 33 , 1 to 7 ?= X By 1 1 : {0} : {0} :{0}";
WDBA.writeln("ans5="+WDBALIB.WDBAQUERY( s23l0251, t));
//Primarykey is used to remove duplicates
String s23l2 ="PrimaryKey from Telecom 0 to 31 , 1 to 7 ?= C By 1 1 : {0} : {0} : {0}";
WDBA.writeln("primarykey="+WDBALIB.WDBAQUERY( s23l2, t));
// foreign key doesn't remove duplicates
ArrayList tsf1p1= WDBASQL.Query("ForeignKey", "Telecom", "0", null, 32, "Telecom", "", null, "", 0, "", "", c, null, t, 1, 7);
WDBA.writeln("foreignkey="+tsf1p1);
String s23l02511 ="SELECTRVAL from Telecom 0 to 33 , 1 to 7 ?= X By 1 1 : {0} : {0} :{0}";
WDBA.writeln("ans51="+WDBALIB.WDBAQUERY( s23l02511, t));
}
}
}
Note:
======
ans1=[1,a1,b1,c1] ; so with in 1 to a1 , a1 to b1 , b1 to c1 the Character B falls;
that's why ans1=[1,a1,b1,c1] .
Output:
======
[SNO CLASS CHILDS 1 A a1 2 A a2 3 A a3 4 B b1 5 B b2 6 B b3 7 C c1 8 C c2 9 C c3 10 C c]
ans5=[[SNO, CLASS, CHILDS, 1, A, a1, 2, A, a2, 3, A, a3, 4, B, b1, 5, B, b2, 6, B, b3, 7, C, c1, 8, C, c2, 9, C, c3, 10, C, c]]
ans1=[1, a1, b1, c1]
ans6=[13, 16, 19]
ans12=[3]
[SNO CLASS CHILDS 1 A a1 2 A a2 3 A a3 4 B b1 5 B b2 6 B b3 7 C c1 8 C c2 9 C c3 10 C c]
ans5=[[SNO, CLASS, CHILDS, 1, A, a1, 2, A, a2, 3, A, a3, 4, B, b1, 5, B, b2, 6, B, b3, 7, C, c1, 8, C, c2, 9, C, c3, 10, C, c]]
primarykey=[CLASS, A, B, C, b3, b2, SNO, b1, a1, a2, a3, CHILDS, c3, 3, 2, 10, 1, 7, c1, 6, c2, 5, 4, 9, 8]
foreignkey=[SNO, CLASS, CHILDS, 1, A, a1, 2, A, a2, 3, A, a3, 4, B, b1, 5, B, b2, 6, B, b3, 7, C, c1, 8, C, c2, 9, C, c3, 10, C, c]
[SNO CLASS CHILDS 1 A a1 2 A a2 3 A a3 4 B b1 5 B b2 6 B b3 7 C c1 8 C c2 9 C c3 10 C c]
ans51=[[SNO, CLASS, CHILDS, 1, A, a1, 2, A, a2, 3, A, a3, 4, B, b1, 5, B, b2, 6, B, b3, 7, C, c1, 8, C, c2, 9, C, c3, 10, C, c]]
=================================================================================================
SAMPLE 22: Use of CREATESAVEPOINT ,SAVEPOINTLOC(),ROLLBACK(),COMMIT()
=================================================================================================
sample22.wnosql
<WNOSQL>
<PACK>
<USE> CDollar.WDBA;
<USE> WDBA;
<DATALIB> ps
<DATA>
public <CLASS> DATA
{
public void main()
{
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
Char c=' ';
// List the values from AGG
String s11 = "SELECTRVAL from AGG 0 to 0 , 1 to 7 ?= X By 1 1 : {0} : {0} :{0}";
WDBA.writeln("" + WDBALIB.WDBAQUERY(s11, t));
// Now SAVEPOINT is applied and it is created.
WDBASQL.Query("CREATESAVEPOINT", "AGG", "0", null, 0, "", "", null, "", 0, "", "", c, null, t, 7,7);
ArrayList locs = new ArrayList();
locs.add(2);
locs.add(5);
//Save point at location 2,5
WDBA.writeln("savepoint="+WDBASQL.Query("SAVEPOINTLOC()", "AGG", "0", null, 0, "", "", locs, "", 0, "", "", c, null, t, 1,7));
//insert some values in AGG table
String s12 = "INSERTINTO from AGG 3 to 28 , 1 to 7 ?= X By 1 1 : {0} : {34,45,56,67,43,678} : {0}";
WDBA.writeln("Inserted=" + WDBALIB.WDBAQUERY(s12, t));
// Rollback to save point
ArrayList locsd = WDBASQL.Query("ROLLBACK()", "AGG", "0", null, 0, "", "", null, "", 0, "", "", c, null, t, 1,7);
WDBA.writeln("los="+locsd);
//COMMIT command saves all the transactions to the database but did not save newly inserted values; Since Rollback is applied on table AGG...
WDBA.writeln("commit="+WDBASQL.Query("COMMIT()", "AGG", "0", null, 0, "", "",null , "", 0, "", "", c, locsd, t, 1,7));
// SelectAll will list the AGG table values from 0 to 29
ArrayList colsdg =WDBASQL.Query("SelectAll","AGG" ,"0",null,29,"","", null,"",0," ","",c,null,t,1,7);
WDBA.writeln("wil="+colsdg);
}
}
}
OUTPUT:
======
List AGG table contents
=====================
[[[[[[[[[[[[[[[[[1 2 3 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 23 24 25 26 27]]]]]]]]]]]]]]]]]
savepoint=[[2, 5]]
Inserted=[1, 2, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 34, 45, 56, 67, 43, 678]
[[[[[[[[[[[[[[[[[[1 2 3 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 23 24 25 26 27]]]]]]]]]]]]]]]]]]
los=[[[[[[[[[[[[[[[[[[[1, 2, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27]]]]]]]]]]]]]]]]]]]
commit=[Transcation commited at Table =AGG]
wil=[1, 2, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27]
=================================================================================================
SAMPLE :23 : Use of Indexes with Index counter value
=================================================================================================
indexes.wnosql
==============
<WNOSQL>
<PACK>
<USE> CDollar.WDBA;
<USE> WDBA;
<DATALIB> ps
<DATA>
public <CLASS> DATA
{
public void main()
{
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
Char c=' ';
ArrayList ar71= new ArrayList();
ar71.add(3);
// Indexes are used to quickly locate data without having to search every row in a database //table every time a database table is accessed
// In arraylist ar71 is given 3 AS INDEX COUNTER VALUE ; and SO 3rd location , 6 th //location ,etc is printed
ArrayList arhg8ey =WDBASQL.Query("SELECTINDEXES","AGG" ,"0",null,0,"3","",ar71,"",0,"","",c,null,t,1,7);
WDBA.writeln("wilindexes="+arhg8ey);
}
}
}
Explanation
============
String s11 = "SELECTRVAL from Employee 0 to 0 , 1 to 6 ?= X By 1 1 : {0} : {0} :{0}";
// Select the values from Employee
WDBA.Writeln("" + WDBALIB.WDBAQUERY(s11, t));
now you can store in array list for Future use ie)
ArrayList ar5= WDBALIB.WDBAQUERY(s11, t);
so it is called as Indexing in wnosql.
Output:
=======
wilindexes=[3, 6, 9, 12, 15, 18, 21, 24, 27]
=================================================================================================
SAMPLE :24 : Use of HAVING Clause
=================================================================================================
havings.wnosql
==============
<WNOSQL>
<PACK>
<USE> CDollar.WDBA;
<USE> WDBA;
<DATALIB> ps
<DATA>
public <CLASS> DATA
{
public void main()
{
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
char c= ' ';
String s1g ="SELECTRVAL from AGG 0 to 9 , 1 to 7 ?= C By 1 1 : {0} : {0} :{1}";
ArrayList arjkk= WDBALIB.WDBAQUERY(s1g, t);
WDBA.writeln("ans151j="+arjkk);
//MIN() is to find minimum for the rowset 3,6,9,12,15,18; we get [1.0] as the output.
String s23l02562u ="MIN() from AGG 0 to 29 , 1 to 7 ?= C By 1 1 : {3,6,9,12,15,18} : {0} :{0}";
WDBA.writeln("ans7="+WDBALIB.WDBAQUERY( s23l02562u, t));
ArrayList avgs=WDBALIB.WDBAQUERY( s23l02562u, t);
//convert String to double
double val = Convert.ToDouble(avgs.get(0).ToString());
//convert double to integer
int sd=Convert.ToInt32(val);
// SearchGT than 1 value is [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
// 23, 24]
String s121377 ="SearchGT from AGG 3 to 25 , 1 to 7 ?= "+sd+" By 1 1 : {0} : {0} :{0}";
WDBA.writeln("datas51="+WDBALIB.WDBAQUERY( s121377, t));
ArrayList colss71=WDBALIB.WDBAQUERY( s121377, t);
ArrayList colss7 = new ArrayList();
colss7.add(1);
// where as colss7 indicates increment by 1
// now combine the rowset1 value and rowset2 value ie) [3,6,12,2],[13,6,12,14] rowsets //value is =[ 1, 4, 10, 3, 11, 4, 10, 12] with SearchGT than 1 value is [2, 3, 4, 5, 6, 7, 8, 9, 10, //11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24] using <HAVING> clause.
//we use SearchGT (search greater) than 1 value is [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24]
// thus we get the output as having=[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 1, 4, 10, 3, 11, 4, 10, 12]
ArrayList datas16=WDBASQL.Query("<HAVING>","AGG","0",null,3,"[3,6,12,2],[13,6,12,14]","",colss7,"",0,"","",c,colss71,t,1,7);
WDBA.writeln("having="+datas16);
}
}
}
Output
======
ans151j=[[1, 2, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27]]
ans7=[1.0]
datas51=[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24]
having=[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 1, 4, 10, 3, 11, 4, 10, 12]
===========================================================================
SAMPLE :25 : Use of WNOSQL Funnel
===========================================================================
WNOSQL Funnel
=============
It is used to transfer data from oracle db to wnosql db.
so it is called as Wnosql Funnel or wnosql pipe.
Write a Java/oakjava7 program using wnosql pipe to
get data from employees table in oracle db and Automatically create a tables employees,employees2 in wnosql db and copy the records from employees table(from oracle) to wnosql db tables employees,employees2:-
wnosqlpipe.java
=================
import java.sql.*;
import java.util.*;
import Securitydb.*;
import jxl.read.biff.BiffException;
import java.io.*;
public class wnosqlpipe{
public static void main(String args[])
{
try{
//pass parameters for table employees
HTML.displayhtml("employees.html");
String params =
"employee_id,first_name,last_name,EMAIL,PHONE_NUMBER";
// specify oracle drive ,oracle connection,oracle username,oracle password,Oracle Query,employees table parameters params, howmany parameters,
//wnosql path,wnosql username,wnosql pwd , tablename, tablesize,row,cols
wnosqlCon.Backupcall("oracle.jdbc.driver.OracleDriver","jdbc:oracle:thin:@localhost:1521:xe","hr","dove1234",
"Select employee_id,first_name,last_name,EMAIL,PHONE_NUMBER from employees",params,4,"C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod",
"wilmix78","wilmix78","employees",5,1,7,1);
//5 represent 5 fields of select query
// 1 indicates it will display all the values in Table format
// 0 indicates storing data in Arraylist format for future use.
// 1,7 represents row and cols in wnosql db storage cell
//pass parameters for table employees2 (remaining fields off employees)
String params1="employee_id,job_id,salary,commission_pct,manager_ID,Department_ID";
// specify oracle drive ,oracle connection,oracle username,oracle password,Oracle Query,employees table parameters params, howmany parameters,
//wnosql path,wnosql username,wnosql pwd , tablename, tablesize,row,cols
System.out.println("<HR>");
ArrayList ard =
wnosqlCon.Backupcall("oracle.jdbc.driver.OracleDriver","jdbc:oracle:thin:@localhost:1521:xe","hr","dove1234",
"Select employee_id,job_id,salary,commission_pct,manager_ID,Department_ID from employees where salary > 2000"
,params1,5,"C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod",
"wilmix78","wilmix78","employees2",6,1,7,0);
// 1,7 represents row and cols in wnosql db storage cell
//6 represent 6 fields of select query
// 0 indicates storing data in Arraylist format for future use.
System.out.println(ard);
}
catch(Exception e)
{
System.out.println(""+e);
}
}
}
Note:
The query "Select employee_id,job_id,salary,commission_pct,manager_ID,Department_ID from employees where salary > 2000" in api
wnosqlCon.Backupcall indicates Oracle query.
Output
=======
what are the records of employees table in oracle are added to
wnosql employees table (employees,employees2).
wnosql employees table is divided in to
two types which are employees,employees2.
so when you run wnosql server you will get the
output which is given below.
==============================================================================
SAMPLE-26 : Use of InsertDESC,LEFTJOIN,DropTable,SearchLS
==============================================================================
sample26.wnosql
===============
<WNOSQL>
<PACK>
<USE> CDollar.WDBA;
<USE> WDBA;
<DATALIB> ps
<DATA>
public <CLASS> DATA
{
public void main()
{
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
// Insert table Description to AGGS table as table fields NAME,SNO,SNO1
String s10011 ="InsertDESC from AGGS 0 to 29 , 0 to 1 ?= C By 1 1 : {NAME,SNO,SNO1} : {0} :{0}";
WDBA.writeln("trig="+WDBALIB.WDBAQUERY( s10011, t));
// To Perform Leftjoin for same table Telecom use LEFTJOIN
String s12 ="LEFTJOIN from Telecom 0 to 29 , 1 to 7 ?= Telecom By 1 1 : {1,2,3} : {1,2,3} :{1,2,3}";
WDBA.writeln("ans="+WDBALIB.WDBAQUERY( s12, t));
// DropTable is used to delete the table Telecom
String s127 ="DropTable from Telecom 0 to 29 , 1 to 7 ?= C By 1 1 : {0} : {0 :{0}";
WDBA.writeln("ans1="+WDBALIB.WDBAQUERY( s127, t));
// list numbers which are lesser than 100
String s121377 ="SearchLS from datastoreh 50 to 200 , 1 to 1 ?= 100 By 1 1 : {0} : {0} :{0}";
WDBA.writeln("datas51"+WDBALIB.WDBAQUERY( s121377, t));
// list from table description table AGGS
String s1009 ="SELECTRVAL from AGGS 3 to 29 , 0 to 1 ?= C By 1 1 : {0} : {0} :{0}";
WDBA.writeln(""+WDBALIB.WDBAQUERY( s1009, t));
}
}
}
OUTPUT:
=======
trig=[Inserted Columns[NAME, SNO, SNO1]]
ans=[ CLASS, CHILDS, 1]
datas51[47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]
[NAME SNO SNO1][[NAME, SNO, SNO1]]
==============================================================================
Faqs: How to install wnosql data? What is the directory structure for wnosql data configuration? If you write a code in wnosql-cweeditor ..?
==============================================================================
How to install wnosql data? What is the directory structure for wnosql data configuration?
1) Kindly create a directory
like this C:\Programs\WNOSQL\WNOSQLProgramfiles
and extract WNOSQL-cod.rar in c:\Programs\WNOSQL\WNOSQLProgramfiles;
so directory structure will look like C:\Programs\WNOSQL\WNOSQLProgramfiles\WNOSQL-cod.
2)After that copy cdollar directory and paste it in C:/Programs directory
so this wnosql datasetup is configured succesfully.
After that Directory structure will look like as shown in the screen shot which
is given below.
3) If you write a code in wnosql-cweeditor which is given below...
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
ie) If wnosql data directory as "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod"
that means wnosql data directory structure will look like C:\Programs\WNOSQL\WNOSQLProgramfiles\WNOSQL-cod.
ie) If wnosql data directory as "d:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod"
that means wnosql data directory structure will look like d:\Programs\WNOSQL\WNOSQLProgramfiles\WNOSQL-cod.
This indicates Wnosql db data can be put at any directory or any USB drive or Hitachi drive, no need of datasource or anything.
==============================================================================
Note: If we try to all the screenshot will make the google site very slow.
That's why put the output only in text format
WNOSQL(*) Securable database contains vast samples that's why we limit putting the screenshot in googlesite..