In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces the "codeigniter use skills bulk data insertion method tutorial", in the daily operation, I believe that many people have doubts in the codeigniter use skills bulk data insertion method tutorial, Xiaobian consulted all kinds of materials, sorted out simple and easy-to-use operation methods, hope to answer the "codeigniter use skills bulk data insertion method tutorial" to help! Next, please follow the editor to study!
The copy code is as follows:
$sub_form = array ()
$loop = 0
$ins_loop = 0
$sum = count ($form_datas)
$this- > logger- > info ('insert data total:'.$sum)
/ / using bulk import of things helps to improve insertion efficiency
$callStartTime = microtime (true)
$this- > db- > trans_start ()
Foreach ($form_datas as $item) {
$loop + +
$sub_form [] = $item
If (($loop% 200) = = 0 | | $loop = = $sum) {
$this- > logger- > info ('insert data num:'.$loop)
$res = $this- > kb_object_instance_mdl- > insert_batch ($sub_form,$obj_id)
$ins_loop + +
Unset ($sub_form)
If (($ins_loop% 5) = = 0) {
$this- > logger- > info ('insert data trans_complete ins_loop:'.$ins_loop)
$this- > db- > trans_complete ()
If ($loop! = $sum) {
$this- > db- > trans_start ()
}
}
}
}
/ / $this- > db- > trans_complete ()
$callEndTime = microtime (true)
$callTime = $callEndTime-$callStartTime
$this- > logger- > info ('insert data use time:'.sprintf (' .4f', $callTime))
If ($this- > db- > trans_status () = TRUE) {
$this- > _ show_msg ('1century journal array (' data'= > 'import ok'))
} else {
$this- > _ show_error ('saveOrUpdate error')
}
At this point, the study on the "codeigniter techniques for bulk data insertion method tutorial" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.