Comments (1)
So the issue is that the format
function takes two arguments: first is the sting of SQL with ?
placeholders and the second is an array where each element corresponds to each ?
. You see, you called it as the following:
require('sqlstring').format('?', [ [12, 34], [56, 78] ])
Where that deconstructs as:
let arg1 = '?'
let arg2 = [ [12, 34], [56, 78] ]
require('sqlstring').format(arg1, arg2)
So the first ?
in your arg1
will be the first element in the array arg2
, which is arg2[0]
, which is just [12, 34]
. Really you wanted that to be the entire thing.
The correct call is the following:
require('sqlstring').format('?', [ [ [12, 34], [56, 78] ] ])
// => '(12, 34), (56, 78)'
from sqlstring.
Related Issues (20)
- format() returns object string instead of value HOT 2
- Prople with json string HOT 2
- Formatting a SELECT list for INSERT INTO SELECT usage HOT 1
- Adding basic support for POINT HOT 5
- TypeError: val.toString is not a function HOT 6
- How to use "?" placeholders with bigint values? HOT 6
- Parameterized Identifiers HOT 1
- Add support for native BigInt HOT 6
- Clarify support for passing a string to the second argument of format HOT 2
- can you add function for SELECT sql query HOT 1
- No idea to escape single quote' and double quote". HOT 1
- Column escaping is broken when using MySQL version 8.0.21 HOT 3
- sqlstring.escape() wraps input with double quotes, mysql driver throwing ER_PARSE_ERROR when queried. HOT 2
- can it support set alias? HOT 1
- How to use a literal `?` in a formatted query? HOT 1
- format sql with dynamic limit (LIMIT ?, ?) HOT 2
- If the search word includes `%`... HOT 3
- When Recieving Key-Value pair, Where the Value is Array. Use IN Instead of = HOT 2
- Escaping date sometimes results in empty string HOT 8
- single quote bad escape HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqlstring.