Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
thecancerus committed May 15, 2021
2 parents 03bc795 + 75bd02e commit 8f5ffcb
Show file tree
Hide file tree
Showing 8 changed files with 790 additions and 0 deletions.
89 changes: 89 additions & 0 deletions apps/samples/Mysqli-part-1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
[templates.add main]

//**
Desc : This will help us to manage CREATE,UPDATE,DELETE COMMAND
Data Definition Language (DDL) and Data Manipulation Language (DML)
return : <array>**//

//****//
[mysqli.cud o.set=template.result.cud]
create table sample_test (
id int primary key,
name varchar(255)
);

insert into sample_test (id,name) values (1,'Rajesh'),(2,'Ramesh');

#update sample_test set name="SAM" where id=1;

#delete from sample_test where id=1;

#alter table sample_test add column city varchar(255);

#truncate table sample_test;

#drop table demo;

[/mysqli.cud]

//**

Desc : Fetch multiple rows from table
Data Query Language (DQL)
return : <return>
**//
[mysqli.fetch.rows o.set=template.result.rows]
select * from sample_test;
[/mysqli.fetch.rows]



//**
Desc : Fetch single row from table
return : <return>
**//
[mysqli.fetch.row o.set=template.result.row]
select * from sample_test where id=1;
[/mysqli.fetch.row]


//**
Desc : This will help us to manage single row/alice to fetch.row
return : <return>
**//
[mysqli.fetch.exactly_one_row o.set=template.result.exact_one_row]
select * from sample_test where id=1;
[/mysqli.fetch.exactly_one_row]



//**
Desc : Fetch only ONE column value
return : <return>
**//
[mysqli.fetch.col o.set=template.result.col]
select name from sample_test ;
[/mysqli.fetch.col]


//**
Desc : performs a calculation on a set of values, and returns a single value.
return : <return>
example , min(), max(),count(),sum() etc
**//
[mysqli.fetch.scalar o.set=template.result.scalar]
select count(1) from sample_test;
[/mysqli.fetch.scalar]


//**
Desc : alice to scalar
return : <return>
example , min(), max(),count(),sum() etc
**//
[mysqli.fetch.count o.set=template.result.count]
select count(1) from sample_test;
[/mysqli.fetch.count]

[template.result.echo /]
[/templates.add]
138 changes: 138 additions & 0 deletions apps/samples/Mysqli-part-2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
[templates.add main]

<h3> TCL (Transaction Control Language)</h3>

//**
Desc : This will help us to manage multiple queries CREATE,UPDATE,DELETE COMMAND
Data Definition Language (DDL) and Data Manipulation Language (DML)
return : <array>**//


[mysqli.multi.cud o.set=template.result.cud]

drop table if exists multi_sample_test ;

create table multi_sample_test (
id int primary key,
name varchar(255),
age int
);

insert into multi_sample_test (id,name,age) values (1,'Rajesh',18),(2,'Ramesh',18);

update multi_sample_test set name="SAM" where id=1;

delete from multi_sample_test where id=1;

alter table multi_sample_test add column city varchar(255);

#truncate table multi_sample_test;

#drop table multi_sample_test;

[/mysqli.multi.cud]

//**

Desc : Fetch multiple rows from table
Data Query Language (DQL)
return : <return>
**//
[mysqli.multi.fetch.rows o.set=template.result.rows]
set @age=18;
select * from multi_sample_test where age= @age;
[/mysqli.multi.fetch.rows]



//**
Desc : Fetch single row from table
return : <return>
**//
[mysqli.multi.fetch.row o.set=template.result.row]
set @id=2;
select * from multi_sample_test where id=@id;
[/mysqli.multi.fetch.row]

//**
Desc : This will help us to manage single row/alice to fetch.row
return : <return>
**//
[mysqli.multi.fetch.exactly_one_row o.set=template.result.exact_one_row]
set @id=2;
select * from multi_sample_test where id=@id;
[/mysqli.multi.fetch.exactly_one_row]



//**
Desc : Fetch only ONE column value
return : <return>
**//
[mysqli.multi.fetch.col o.set=template.result.col]
set @id=2;
select name from multi_sample_test where id=@id;
[/mysqli.multi.fetch.col]


//**
Desc : performs a calculation on a set of values, and returns a single value.
return : <return>
example , min(), max(),count(),sum() etc
**//
[mysqli.multi.fetch.scalar o.set=template.result.scalar]
set @id=2;
select count(1) from multi_sample_test where id=@id;
[/mysqli.multi.fetch.scalar]


//**
Desc : alice to scalar
return : <return>
example , min(), max(),count(),sum() etc
**//
[mysqli.multi.fetch.count o.set=template.result.count]
set @id=2;
select count(1) from multi_sample_test where id=@id;
[/mysqli.multi.fetch.count]


//**
commit the transaction
**//
[mysqli.transaction.commit o.set=template.result.commit]

drop table if exists multi_sample_test_t2;

create table multi_sample_test_t2 (
id int primary key,
name varchar(255),
age int
);

insert into multi_sample_test_t2 (id,name,age) values (1,'Rajesh',20),(2,'Ramesh',20);
[/mysqli.transaction.commit]


//**
rollback the transaction
**//
[mysqli.transaction.rollback o.set=template.result.rollback]
update multi_sample_test_t2 set age=40 where id=1;
[/mysqli.transaction.rollback]


//**

Desc : Fetch multiple rows from table
Data Query Language (DQL)
return : <return>
**//
[mysqli.multi.fetch.row o.set=template.result.rollback_rows]
set @id=1;
select * from multi_sample_test_t2 where id=@id;
[/mysqli.multi.fetch.row]
[debug.ignore]
[/debug.ignore]
[template.result.dump /]
[/templates.add]
55 changes: 55 additions & 0 deletions apps/samples/form-control.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[templates.add main]

<div class="gap-4"></div>


[session_ticket.create o.set=template.ticket/]
[session_ticket.set_activity {template.ticket} app='{app.slug}' module='{module.slug}.submit' /]

<h3> Contact Us </h3>
<section role="changing-form-block">

<form class="horizontal loan-tap-form"
id="contact_us"
novalidate
>

//** Load form fields according to steps **//
[form_control2.text id="full_name" label="Full Name" required=yes plcaceholder="Full Name" /]

[form_control2.email id="email_id" label="Email Id" placeholder="Email Id" required=yes /]

[form_control2.textarea id="comment" label="Comment" placeholder="Comment" required=yes /]

[form_control2.button type="submit" value='<i class="fa fa-check icon icon-check"></i> Submit Details' /]

</form>

<template
type=spa/axn
axn='form.ajax'
bind='submit'
bind_selector='#contact_us'
route_ajax='t/[template.ticket/]'
disable_selector='.btn'
>
</template>

</section>



<div class="gap-4"></div>

<div id="update-block"></div>

[/templates.add]

[templates.add submit]
[template.set req={request2} /]
[template.echo /]

<template axn=selector.update selector='#update-block' get='me.html'>
<h3> [template.req.dump/] Thank you for showing interest </h3>
</template>
[/templates.add]
Loading

0 comments on commit 8f5ffcb

Please sign in to comment.