mirror of https://github.com/interlegis/sapl.git
Marcio Mazza
7 years ago
1 changed files with 26 additions and 0 deletions
@ -0,0 +1,26 @@ |
|||
#!/bin/bash |
|||
|
|||
ARQUIVO=$1 |
|||
BANCO=`echo $1 | cut -f1 -d.` |
|||
TMP=__tmp.sql |
|||
|
|||
cat << EOF > $TMP |
|||
|
|||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; |
|||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; |
|||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; |
|||
/*!40101 SET NAMES utf8 */; |
|||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; |
|||
/*!40103 SET TIME_ZONE='+00:00' */; |
|||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; |
|||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; |
|||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; |
|||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; |
|||
|
|||
EOF |
|||
|
|||
echo "CREATE DATABASE /*!32312 IF NOT EXISTS*/ \`$BANCO\` /*!40100 DEFAULT CHARACTER SET latin1 */;" >> $TMP |
|||
echo >> $TMP |
|||
echo "USE \`$BANCO\`;" >> $TMP |
|||
sed 1,`grep -n '^USE ' $ARQUIVO |cut -f1 -d:`d $ARQUIVO >> $TMP |
|||
mv $TMP $ARQUIVO |
Loading…
Reference in new issue