Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7698681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:17:57+00:00 2026-05-31T22:17:57+00:00

I have a small data conversion application that converts xml into a json then

  • 0

I have a small data conversion application that converts xml into a json then stores it in a mySql DB, using node, express & node-mysql

it works very well until I do large batches, this has nothing to do with the module or mySql but it seems that there is some trickery going on in node.

To format the data for an insert I need to have the data in a basic Array so I do something like this.

var keys = ['first_name', 'last_name', 'mi'], values, que, i, q;
values = []
que = []
i = 0
// data is a json array with corresponding keys
while(i < data.length){

    values.length = 0

    q = 0

    for(key in data[i]){

        values.push(data[i][keys[q]]);


        q += 1
    }

    que.push(values)

    verifyInsert(i)

    i += 1
}

When i do this with one entry the app works wonderful, but when i do multiple i get the last entry many times.

There is nowhere that i overwrite que but for some reason after each iteration the all the values in que change. In normal javascript I use this method all the time to construct an array with reusable variable, then I store the instance in another location. Destroy the values in the reusable variable values.length = 0.

Does this method not work in node? because it seems that im storing the variable itself not the instance of the variable.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T22:17:58+00:00Added an answer on May 31, 2026 at 10:17 pm

    Seems like that’s your problem, that its storing the variable itself.

    To overcome this, you should do

    values = [];

    in your loop. That will create a new array for each iteration

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small application that uses a SharePoint list as the data source.
I have some (small amount) of data that I'll need quick access to on
I have an application where I am reading and writing small blocks of data
I have small application that is uploading pictures to another website via webservice. My
Is it possible to filter out subsets of the data that have small numbers
I have written a small Asp.net application using Entity Framework. A Stored Procedure accepts
I have small application, and I will have some external applications put data to
I have a small test application I'm writing in Java to parse some JSON
I have small COCOA Mac OS application to play with core data. I have
I have a small database with tables containing a small amount of data which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.