Skip to content

Commit

Permalink
Release 1.10.4
Browse files Browse the repository at this point in the history
Export format sql: New options sql.tableEnclosure and sql.columnEnclosure
  • Loading branch information
hhurz committed May 29, 2019
1 parent 0157755 commit 95ba5c7
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 62 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ pdfmake: enabled: false
preserve: leadingWS: false
trailingWS: false
preventInjection: true
sql: tableEnclosure: '`'
columnEnclosure: '`'
tbodySelector: 'tr'
tfootSelector: 'tr'
theadSelector: 'tr'
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tableexport.jquery.plugin",
"version": "1.10.3",
"version": "1.10.4",
"description": "html table export",
"main": "tableExport.js",
"authors": [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tableexport.jquery.plugin",
"version": "1.10.3",
"version": "1.10.4",
"description": "html table export",
"main": "tableExport.min.js",
"dependencies": {
Expand Down
10 changes: 7 additions & 3 deletions tableExport.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @preserve tableExport.jquery.plugin
*
* Version 1.10.3
* Version 1.10.4
*
* Copyright (c) 2015-2019 hhurz, https://github.com/hhurz
*
Expand Down Expand Up @@ -106,6 +106,10 @@
trailingWS: false // preserve trailing white spaces
},
preventInjection: true, // Prepend a single quote to cell strings that start with =,+,- or @ to prevent formula injection
sql: {
tableEnclosure: '`', // If table or column names contain any characters except letters, numbers, and
columnEnclosure: '`' // underscores usually the name must be delimited by enclosing it in back quotes (`)
},
tbodySelector: 'tr',
tfootSelector: 'tr', // Set empty ('') to prevent export of tfoot rows
theadSelector: 'tr',
Expand Down Expand Up @@ -268,12 +272,12 @@
// Header
rowIndex = 0;
ranges = [];
var tdData = "INSERT INTO `" + defaults.tableName + "` (";
var tdData = "INSERT INTO " + defaults.sql.tableEnclosure + defaults.tableName + defaults.sql.tableEnclosure + " (";
$hrows = collectHeadRows ($(el));
$($hrows).each(function () {
ForEachVisibleCell(this, 'th,td', rowIndex, $hrows.length,
function (cell, row, col) {
tdData += "'" + parseString(cell, row, col) + "',";
tdData += defaults.sql.columnEnclosure + parseString(cell, row, col) + defaults.sql.columnEnclosure + ",";
});
rowIndex++;
tdData = $.trim(tdData).substring(0, tdData.length - 1);
Expand Down
Loading

0 comments on commit 95ba5c7

Please sign in to comment.