ue-wording-js-20141125

Source: Internet
Author: User
Tags ultraedit

function Trim (str)
{
Remove the blanks from STR
var Temp1 = str.replace (/(^\s*) | ( \s*$)/g, "");
Remove the single quotation marks from the end of STR
var temp2 = temp1.replace (/(^ ' *) | (' *$)/g, "");
Remove the double quotation marks from the end of STR
var Temp3 = temp2.replace (/(^ "*) | (" *$)/g, "");
return Temp3;
}
Array grouping
function Count_str (text_all,str_f)
{
var result = "";
result = Text_all.split (str_f);
return result.length-1;
return result;
}
UltraEdit.activeDocument.findReplace.regExp = true;
var str_f = "^db";
var str_s = "^select";


UltraEdit.activeDocument.bottom (); Jumps to the end of the file.


==mongo.find==
Ultraedit.document[0].write ("\n===========\n")
UltraEdit.activeDocument.top ();
UltraEdit.activeDocument.findReplace.find (Str_f); Find String Str_f
while (UltraEdit.activeDocument.isFound ())//If you find a string to query, execute the following program
{
UltraEdit.activeDocument.selectLine ();
line = UltraEdit.activeDocument.selection;
Ultraedit.messagebox ("Find:" +line);
var array = line.split (":"); into arrays
var array = count_str (line, ":");
var arr2 = Array[0].split ("{");
var arr3 = Array[1].split ("}");
var arr4 = Arr2[0].split (".");
Ultraedit.messagebox (arr4[1]+ "," +arr2[1]+ "," +arr3[0 ");
var tab_name = arr4[1];
var key_name2 = arr2[1];
var key_name = Trim (key_name2)
var key_value2 = arr3[0];
var key_value = Trim (key_value2)
var filed_0 = ' db. ' +tab_name+ '. Find ({"' +key_name+ '": "' +key_value+ '"},{"Logicaldel": 1}). Pretty () ';
var filed_1 = ' db. ' +db_name+ '. Remove ({"' +key_name+ '": "' +key_value+ '"}) ';
var filed_2 = ' db. ' +tab_name+ '. Update ({"' +key_name+ '": "' +key_value+ '"},{$set: {"Logicaldel": Numberint (1)}}) ';
Ultraedit.messagebox (filed_0+ "\ n" +filed_1);
Ultraedit.messagebox (filed_2);
Ultraedit.document[0].write (filed_0+ "\ n");
Ultraedit.document[0].write (filed_2+ "\ n")
UltraEdit.activeDocument.findReplace.find (Str_f);
}
Ultraedit.document[0].write ("\n===========\n")
==mongo.update==
UltraEdit.activeDocument.top ();
UltraEdit.activeDocument.findReplace.find (Str_f); Find String Str_f
while (UltraEdit.activeDocument.isFound ())//If you find a string to query, execute the following program
{
UltraEdit.activeDocument.selectLine ();
line = UltraEdit.activeDocument.selection;
Ultraedit.messagebox ("Find:" +line);
var array = line.split (":"); into arrays
var array = count_str (line, ":");
var arr2 = Array[0].split ("{");
var arr3 = Array[1].split ("}");
var arr4 = Arr2[0].split (".");
Ultraedit.messagebox (arr4[1]+ "," +arr2[1]+ "," +arr3[0 ");
var tab_name = arr4[1];
var key_name2 = arr2[1];
var key_name = Trim (key_name2)
var key_value2 = arr3[0];
var key_value = Trim (key_value2)
var filed_0 = ' db. ' +tab_name+ '. Find ({"' +key_name+ '": "' +key_value+ '"},{"Logicaldel": 1}). Pretty () ';
var filed_1 = ' db. ' +db_name+ '. Remove ({"' +key_name+ '": "' +key_value+ '"}) ';
var filed_2 = ' db. ' +tab_name+ '. Update ({"' +key_name+ '": "' +key_value+ '"},{$set: {"Logicaldel": Numberint (1)}}) ';
Ultraedit.messagebox (filed_0+ "\ n" +filed_1);
Ultraedit.messagebox (filed_2);
Ultraedit.document[1].write (filed_0+ "\ n");
Ultraedit.document[0].write (filed_2+ "\ n")
UltraEdit.activeDocument.findReplace.find (Str_f);
}


==mysql.select==
Ultraedit.document[0].write ("\n===========\n")
UltraEdit.activeDocument.top ();
UltraEdit.activeDocument.findReplace.find (str_s); Find String Str_f
while (UltraEdit.activeDocument.isFound ())//If you find a string to query, execute the following program
{
UltraEdit.activeDocument.selectLine ();
line = UltraEdit.activeDocument.selection;
Ultraedit.messagebox ("Find:" +line);
var arr = count_str (line, "");
Ultraedit.messagebox (arr[3]+ "," +arr[5]);
var Table_name=trim (arr[3]);
var arr2 = Count_str (arr[5], "=");
Ultraedit.messagebox (arr2[0]+ "," +arr2[1]);
var column_name =trim (arr2[0]);
var column_value2 =trim (arr2[1]);
var column_value =count_str (column_value2, "\" ")
var filed_4 = ' select * ' from ' +table_name+ ' where ' +column_name+ ' = ' +column_value[0]+ ' "\\g ';
Ultraedit.messagebox (Filed_4);
Ultraedit.document[0].write (filed_4+ "\ n")
UltraEdit.activeDocument.findReplace.find (str_s);
}
==mysql.update==
Ultraedit.document[0].write ("\n===========\n")
UltraEdit.activeDocument.top ();
UltraEdit.activeDocument.findReplace.find (str_s); Find String Str_f
while (UltraEdit.activeDocument.isFound ())//If you find a string to query, execute the following program
{
UltraEdit.activeDocument.selectLine ();
line = UltraEdit.activeDocument.selection;
Ultraedit.messagebox ("Find:" +line);
var arr = count_str (line, "");
Ultraedit.messagebox (arr[3]+ "," +arr[5]);
var Table_name=trim (arr[3]);
var arr2 = Count_str (arr[5], "=");
Ultraedit.messagebox (arr2[0]+ "," +arr2[1]);
var column_name =trim (arr2[0]);
var column_value2 =trim (arr2[1]);
var column_value =count_str (column_value2, "\" ")
var filed_4 = ' Update ' +table_name+ ' set logicaldel=1 where ' +column_name+ ' = "' +column_value[0]+ '"; ';
Ultraedit.messagebox (Filed_4);
Ultraedit.document[0].write (filed_4+ "\ n")
UltraEdit.activeDocument.findReplace.find (str_s);

}
Ultraedit.document[0].write ("commit;\n")

ue-wording-js-20141125

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.