This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELIMITER $$ | |
DROP FUNCTION IF EXISTS is_maior_idade$$ | |
CREATE FUNCTION `is_maior_idade`(DATA_NASCIMENTO DATE, DATA_REFERENCIA DATE) RETURNS VARCHAR(30) CHARSET utf8 | |
BEGIN | |
DECLARE ANOS INT(4); | |
DECLARE EXIT HANDLER FOR SQLEXCEPTION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>br.inf.carlos</groupId> | |
<artifactId>dindin</artifactId> | |
<version>3.0-SNAPSHOT</version> | |
<packaging>war</packaging> | |
<properties> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
<project.vraptor.version>3.5.2</project.vraptor.version> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package br.inf.carlos.dindin.controllers; | |
import java.util.ArrayList; | |
import java.util.Collection; | |
import br.com.caelum.vraptor.Post; | |
import br.com.caelum.vraptor.Resource; | |
import br.com.caelum.vraptor.Result; | |
import br.com.caelum.vraptor.view.Results; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
/opt/apache-tomcat-7-xxx/bin/startup.sh | |
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELIMITER $$ | |
DROP FUNCTION IF EXISTS `CAP_FIRST`$$ | |
CREATE FUNCTION `CAP_FIRST` (palavra VARCHAR(255)) RETURNS VARCHAR(255) | |
BEGIN | |
DECLARE len INT; | |
DECLARE i INT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# export all tables that matches with a specified prefix. | |
mysql [database] -u[user] -p[pass] -N -e 'show tables like "tb_%"' | xargs mysqldump [database] -u[user] -p[pass] > database.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package br.inf.carlos.dindin.components.converters; | |
import java.text.ParseException; | |
import java.text.SimpleDateFormat; | |
import java.util.Calendar; | |
import java.util.Date; | |
import java.util.ResourceBundle; | |
import org.apache.log4j.Logger; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELIMITER $$ | |
DROP PROCEDURE IF EXISTS `update_saldo_caixas`$$ | |
CREATE PROCEDURE `update_saldo_caixas` (data_caixa DATE, id_conta_bancaria BIGINT, id_perfil BIGINT) | |
DETERMINISTIC LANGUAGE SQL MODIFIES SQL DATA | |
BEGIN | |
DECLARE done_caixas INT DEFAULT FALSE; | |
-- Busco todos os caixas da conta a partir de uma data informada. | |
DECLARE CAIXAS CURSOR FOR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
`DROP` , | |
`CREATE` | |
FROM | |
( | |
SELECT | |
CONCAT( "ALTER TABLE `" ,`K`.`TABLE_NAME` ,"` DROP FOREIGN KEY `" ,`K`.`CONSTRAINT_NAME` ,"`;" ) "DROP" , | |
CONCAT( "ALTER TABLE `" ,`K`.`TABLE_NAME` ,"` ADD CONSTRAINT " ,"`fk_" ,`K`.`TABLE_NAME` ,"_" ,`K`.`REFERENCED_TABLE_NAME` ,"1" ,"` FOREIGN KEY (`" ,`K`.`COLUMN_NAME` ,"`) REFERENCES " ,"`" ,`K`.`REFERENCED_TABLE_SCHEMA` ,"`.`" ,`K`.`REFERENCED_TABLE_NAME` ,"` (`" ,`K`.`REFERENCED_COLUMN_NAME` ,"`) ON DELETE " ,`C`.`DELETE_RULE` ," ON UPDATE " ,`C`.`UPDATE_RULE` ,";" ) "CREATE" | |
FROM | |
`information_schema`.`KEY_COLUMN_USAGE` `K` LEFT JOIN `information_schema`.`REFERENTIAL_CONSTRAINTS` `C` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
CONCAT('ALTER TABLE `', st.TABLE_NAME, '` DROP INDEX `', st.INDEX_NAME, '` ;') AS indexes | |
FROM | |
information_schema.STATISTICS st | |
WHERE | |
st.TABLE_SCHEMA = 'your_database' | |
AND | |
st.INDEX_NAME != 'PRIMARY' | |
; |
OlderNewer