Skip to content

Commit 4922251

Browse files
committed
temporary tables
1 parent 0eab208 commit 4922251

File tree

20 files changed

+49
-775
lines changed

20 files changed

+49
-775
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[![jSQL Logo](http://i.imgur.com/VQlJKOc.png)](http://pamblam.github.io/jSQL/)
22

3-
jSQL (Official) - Version 3.3.14 - *Now available without a prescription!*
3+
jSQL (Official) - Version 3.3.16 - *Now available without a prescription!*
44

55
[![npm version](https://badge.fury.io/js/jsql-official.svg)](https://badge.fury.io/js/jsql-official) [![Build Status](https://travis-ci.org/Pamblam/jSQL.svg?branch=master)](https://travis-ci.org/Pamblam/jSQL) [![Inline docs](http://inch-ci.org/github/Pamblam/jSQL.svg?branch=master)](https://github.com/Pamblam/jSQL/wiki) [![Coverage Status](https://coveralls.io/repos/github/Pamblam/jSQL/badge.svg?branch=master)](https://coveralls.io/github/Pamblam/jSQL?branch=master)
66

coveralls.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

jSQL.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* jsql-official - v3.3.14
2+
* jsql-official - v3.3.16
33
* A persistent SQL database.
44
* @author Rob Parham
55
* @website http://pamblam.github.io/jSQL/
@@ -383,6 +383,7 @@ function jSQLDataTypeList(){
383383

384384
function jSQLTable(name, columns, data, types, keys, auto_increment){
385385
var self = this;
386+
self.isTemp = false; // Is a temporary table?
386387
self.name = ""; // Table name
387388
self.columns = []; // Array of column names
388389
self.data = []; // Array of arrays
@@ -692,11 +693,12 @@ function jSQLQuery(type){
692693
self.newvals = {};
693694
self.whereClause = new jSQLWhereClause(self);
694695
self.resultSet = [];
695-
696+
self.isTemp = false;
697+
696698
// Methods that every query class should implement
697699
var methods = ['init', 'ifNotExists', 'execute', 'fetch', 'ignore',
698700
'fetchAll', 'values', 'set', 'where', 'from', 'orderBy', 'asc',
699-
'desc', 'limit', 'distinct'];
701+
'desc', 'limit', 'distinct', 'temporary'];
700702
var queryTypeConstructors = {
701703
CREATE: jSQLCreateQuery,
702704
UPDATE: jSQLUpdateQuery,
@@ -1077,9 +1079,14 @@ function jSQLCreateQuery(){
10771079
if(undefined !== data) this.data = data;
10781080
if(!(this.INEFlag && jSQL.tables.hasOwnProperty(this.tablename))){
10791081
jSQL.tables[this.tablename] = new jSQLTable(this.tablename, this.columns, this.data, this.coltypes, this.keys, this.ai_col);
1082+
if(this.isTemp) jSQL.tables[this.tablename].isTemp = true;
10801083
}
10811084
return this;
10821085
};
1086+
this.temporary = function(){
1087+
this.isTemp = true;
1088+
return this;
1089+
};
10831090
this.fetch = function(){ return null; };
10841091
this.fetchAll = function(){ return []; };
10851092
}
@@ -1214,6 +1221,9 @@ jSQLLexer.token_types = [
12141221
{pattern: /values(?=[\s(`,]|$)/gi,
12151222
type: 'KEYWORD',
12161223
name: "VALUES"},
1224+
{pattern: /temporary(?=[\s(`,]|$)/gi,
1225+
type: 'KEYWORD',
1226+
name: "TEMPORARY"},
12171227
{pattern: /from(?=[\s(`,]|$)/gi,
12181228
type: 'KEYWORD',
12191229
name: "FROM"},
@@ -2465,7 +2475,7 @@ var persistenceManager = new (function(){
24652475
if(self.error!==false) return _throw(self.error);
24662476
var rows = [];
24672477
for(var tbl in jSQL.tables){
2468-
if(!jSQL.tables.hasOwnProperty(tbl)) continue;
2478+
if(!jSQL.tables.hasOwnProperty(tbl) || jSQL.tables[tbl].isTemp) continue;
24692479

24702480
var keys = [];
24712481
for(var i=0; i<jSQL.tables[tbl].keys.unique.length; i++)
@@ -2814,7 +2824,7 @@ function jsql_import(dump){
28142824
}
28152825

28162826
return {
2817-
version: "3.3.14",
2827+
version: "3.3.16",
28182828
tables: {},
28192829
query: jSQLParseQuery,
28202830
createTable: createTable,

jSQL.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jsql-official",
3-
"version": "3.3.14",
3+
"version": "3.3.16",
44
"description": "A persistent SQL database.",
55
"main": "jSQL.min.js",
66
"directories": {

plugins/jSQLEverywhere/examples/example1.html

Lines changed: 0 additions & 56 deletions
This file was deleted.

plugins/jSQLEverywhere/examples/example2.html

Lines changed: 0 additions & 54 deletions
This file was deleted.

plugins/jSQLEverywhere/examples/example3.html

Lines changed: 0 additions & 54 deletions
This file was deleted.

plugins/jSQLEverywhere/jSQLe.js

Lines changed: 0 additions & 55 deletions
This file was deleted.

plugins/jSQLEverywhere/server.html

Lines changed: 0 additions & 6 deletions
This file was deleted.

plugins/xhrCache/README.md

Lines changed: 0 additions & 46 deletions
This file was deleted.

plugins/xhrCache/ajaxtext.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)