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

  • SEARCH
  • Home
  • 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 7827513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:54:34+00:00 2026-06-02T09:54:34+00:00

I want to insert html into a mysql longtext collumn but I keep hitting

  • 0

I want to insert html into a mysql longtext collumn but I keep hitting an error :

/usr/bin/mysql: Argument list too long

when the string size is to big (at least that’s what I think)

this is the code:

link="7red.no"    
result=$( { stdout=$(wget -T10 -t1 "$link" -v -O -) ; } 2>&1; echo "--SePaRaToR--"; echo "$stdout"); 
dowload_stat=${result%$'\n'--SePaRaToR--*}; 
html=${result#*--SePaRaToR--$'\n'}; 
printf -v dowload_stat "%q" "$dowload_stat"
printf -v html "%q" "$html"
sqlHtml='INSERT INTO `'"${tableHtml}"'` (`extracted_link_ID`, `response_header`, `html`, `download_start`, `download_finish`) VALUES ('"'${link_id}'"', '"${dowload_stat:1}"', '"${html:1}"', '"'${start}'"', '"'${finish}'"');'
mysql -u$dbUser -p$dbPass -h$dbHost -P$dbPort -D$dbName --default_character_set utf8 -A -e "$sqlHtml"

I made the code using hacks as some things like mySQL-escaping and outputting stderr and stdout in different variables are not available by default in bash.
I plan to use the code in a worker script for web-indexing/caching so speed is important.
Which brings me to my second question: Is there a faster way of doing this in bash?

  • 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-06-02T09:54:38+00:00Added an answer on June 2, 2026 at 9:54 am

    you should be able to do something like

    mysql -u$dbUser -p$dbPass -h$dbHost -P$dbPort -D$dbName --default_character_set utf8 -A <<EOS 
        INSERT INTO \"${tableHtml}\" ('extracted_link_ID', 'response_header', 'html', 
           'download_start', 'download_finish') 
        VALUES (\"${link_id}\", \"${dowload_stat:1}\", \"${html:1}\", \"${start}\", \"${finish}\");
     EOS
    

    Read up about ‘here documents’ and you should be OK. (Here docs are the <

    If this doesn’t work, and you still get arg list too long, then you don’t have everything quoted correctly. I don’t have mysql available, but given the testing I was able to do, this should work, and the here document can be really long (although I think even they have limits at very large values).

    EOS can be any string, but is meant to be self-documenting short-hand for EndOfScript.

    I’m assuming that mySQL allows columns to be quoted with the bck-quote char. While you can do it because you start off your example with single-quote, not a good shell-fu.

    I hope this helps.

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

Sidebar

Related Questions

I want to insert some value from first and second foreach into database, but
I have this textfield in a html form, which I want to insert into
I am using the html table. I want to insert a new row to
I have some data enclosed in HTML tags. I want to insert this data
I got my html document with the <html> tag, I want to dynamically insert
I want to insert a row into the Database using SqlDataAdapter. I've 2 tables
I want to insert this margin, but I don't know why... I want it
I want to insert a vector into a set like this: set<vector<prmEdge> > cammini;
I'm trying to insert variables from an SQL result into a HTML form in
I want to insert a value from the database into my dropdown menu in

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.