Skip to main content

Posts

Showing posts from June, 2011

Mysql : The sqls for clone db and rename db

-- --------------------------------------------------------------------------------
-- Clone a db
-- Note: comments before and after the routine body will not be stored by the server
-- --------------------------------------------------------------------------------
DELIMITER $$

CREATE DEFINER=`dbname`@`%` PROCEDURE `clone_db`(IN old_db VARCHAR(100), IN new_db VARCHAR(100))
BEGIN
    DECLARE current_table VARCHAR(100);
    DECLARE done INT DEFAULT 0;
    DECLARE old_tables CURSOR FOR select table_name from information_schema.tables where table_schema = old_db  and table_type='BASE TABLE';
    DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;

    OPEN old_tables;
    REPEAT
        FETCH old_tables INTO current_table;
        IF NOT done THEN
        SET @output = CONCAT('create table ', new_db, '.', current_table, ' like ', old_db, '.', current_table, ';');
        PREPARE stmt FROM @output;
        EXECUTE stmt;

        SET @output …

SVN key bindings not working in Eclipse

It may be due to this breaking change in Eclipse 3.6 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.platform.doc.isv/porting/3.6/incompatibilities.html?view=co#objectContribution EDIT: Looks like it definitely is. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=309074. Here's the fix: In the "Customize Perspective" dialog, go to the "Command Groups Availability" tab and check "Team" and "SVN".

64 bits mysql 5 doesn't work on 64 bit windows vista(or 7)

When install the mysql, it came out below Results 1. Prepare configuration (pass) 2. Write configuratin file (pass) 3. Start service (pass) 4. Apply security setting failed with follwoing error Error Nr. 1045 Access denied for user root@localhost (using password:NO)Solution:Here are the steps that worked for me: NOTE: I did not have to open TCP port 3306 at firewall. 1. When service startup fails at MySQL Instance Config Wizard, cancel the wizard, go to Services windows and make sure the MySQL Server is stopped. 2. Execute again MySQL Instance Config Wizard (The service should start now) 3. If step 4 fails (Apply Security Settings), cancel the wizard 4. Create a TXT file (i.e. C:\mysqlpassword.txt) with the following lines UPDATE mysql.user SET Password=PASSWORD('mypassword') WHERE User='root'; FLUSH PRIVILEGES; 5. Open a Command prompt (former DOS console) and execute:(run as administrator ** very important) mysqld --defaults-file="C:\ProgramData…

Eclipse exclude folders from search

The quick and dirty way:
Right click on a folder, go to properties, and mark a folder as derived. Derived entities are excluded from searching by default. The safe way: Create a working set including only those entities you want searched and search only within that working set. See Dave Ray's answer for details on this procedure.