Have you tried using the sql task?

BOb


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of r0lan2
Sent: Tuesday, March 25, 2008 6:30 AM
To: nant-users@lists.sourceforge.net
Subject: Re: [NAnt-users] Executing a mysql script inside Nant


Hi,
This is the complete outup for the command ( the build file is in the
same
directory than the build file =) )

C:\TesisSource\Releases\0.1\SW\l10nCommunity.DataAccess\MySqlDatabase\Co
mmonSqlS
cripts>nant
NAnt 0.85 (Build 0.85.2478.0; release; 14/10/2006)
Copyright (C) 2001-2006 Gerry Shaw
http://nant.sourceforge.net

Buildfile:
file:///C:/TesisSource/Releases/0.1/SW/l10nCommunity.DataAccess/MySql
Database/CommonSqlScripts/DataBase.build
Target framework: Microsoft .NET Framework 2.0
Target(s) specified: CreateAll


CreateStructure:

     [exec] Starting 'mysql ( -h localhost -u root -pholamundo <
CreateDataBase.
sql)' in
'C:\TesisSource\Releases\0.1\SW\l10nCommunity.DataAccess\MySqlDatabase\
CommonSqlScripts'
     [exec] mysql  Ver 14.12 Distrib 5.0.45, for Win32 (ia32)
     [exec] Copyright (C) 2002 MySQL AB
     [exec] This software comes with ABSOLUTELY NO WARRANTY. This is
free
softwa
re,
     [exec] and you are welcome to modify and redistribute it under the
GPL
lice
nse
     [exec] Usage: mysql [OPTIONS] [database]
     [exec]   -?, --help          Display this help and exit.
     [exec]   -I, --help          Synonym for -?
     [exec]   --auto-rehash       Enable automatic rehashing. One
doesn't
need t
o use
     [exec]                       'rehash' to get table and field
completion, bu
t startup
     [exec]                       and reconnecting may take a longer
time.
Disab
le with
     [exec]                       --disable-auto-rehash.
     [exec]   -A, --no-auto-rehash
     [exec]                       No automatic rehashing. One has to use
'rehash
' to get
     [exec]                       table and field completion. This gives
a
quick
er start of
     [exec]                       mysql and disables rehashing on
reconnect.
WAR
NING:
     [exec]                       options deprecated; use
--disable-auto-rehash
instead.
     [exec]   -B, --batch         Don't use history file. Disable
interactive be
havior.
     [exec]                       (Enables --silent)
     [exec]   --character-sets-dir=name
     [exec]                       Directory where character sets are.
     [exec]   --default-character-set=name
     [exec]                       Set the default character set.
     [exec]   -C, --compress      Use compression in server/client
protocol.
     [exec]   -#, --debug[=#]     This is a non-debug version. Catch
this
and ex
it
     [exec]   -D, --database=name Database to use.
     [exec]   --delimiter=name    Delimiter to be used.
     [exec]   -e, --execute=name  Execute command and quit. (Disables
--force an
d history
     [exec]                       file)
     [exec]   -E, --vertical      Print the output of a query (rows)
vertically.

     [exec]   -f, --force         Continue even if we get an sql error.
     [exec]   -G, --named-commands
     [exec]                       Enable named commands. Named commands
mean
thi
s program's
     [exec]                       internal commands; see mysql> help .
When
enab
led, the
     [exec]                       named commands can be used from any
line
of th
e query,
     [exec]                       otherwise only from the first line,
before
an
enter.
     [exec]                       Disable with --disable-named-commands.
This op
tion is
     [exec]                       disabled by default.
     [exec]   -g, --no-named-commands
     [exec]                       Named commands are disabled. Use \*
form
only,
 or use
     [exec]                       named commands only in the beginning
of a
line
 ending
     [exec]                       with a semicolon (;) Since version
10.9
the cl
ient now
     [exec]                       starts with this option ENABLED by
default! Di
sable with
     [exec]                       '-G'. Long format commands still work
from
the
 first
     [exec]                       line. WARNING: option deprecated; use
     [exec]                       --disable-named-commands instead.
     [exec]   -i, --ignore-spaces Ignore space after function names.
     [exec]   --local-infile      Enable/disable LOAD DATA LOCAL INFILE.
     [exec]   -b, --no-beep       Turn off beep on error.
     [exec]   -h, --host=name     Connect to host.
     [exec]   -H, --html          Produce HTML output.
     [exec]   -X, --xml           Produce XML output
     [exec]   --line-numbers      Write line numbers for errors.
     [exec]   -L, --skip-line-numbers
     [exec]                       Don't write line number for errors.
WARNING: -
L is
     [exec]                       deprecated, use long version of this
option in
stead.
     [exec]   -n, --unbuffered    Flush buffer after each query.
     [exec]   --column-names      Write column names in results.
     [exec]   -N, --skip-column-names
     [exec]                       Don't write column names in results.
WARNING:
-N is
     [exec]                       deprecated, use long version of this
options i
nstead.
     [exec]   -O, --set-variable=name
     [exec]                       Change the value of a variable. Please
note th
at this
     [exec]                       option is deprecated; you can set
variables di
rectly with
     [exec]                       --variable-name=value.
     [exec]   --sigint-ignore     Ignore SIGINT (CTRL-C)
     [exec]   -o, --one-database  Only update the default database. This
is
usef
ul for
     [exec]                       skipping updates to other database in
the
upda
te log.
     [exec]   -p, --password[=name]
     [exec]                       Password to use when connecting to
server.
If
password is
     [exec]                       not given it's asked from the tty.
     [exec]   -W, --pipe          Use named pipes to connect to server.
     [exec]   -P, --port=#        Port number to use for connection.
     [exec]   --prompt=name       Set the mysql prompt to this value.
     [exec]   --protocol=name     The protocol of connection
(tcp,socket,pipe,me
mory).
     [exec]   -q, --quick         Don't cache result, print it row by
row.
This
may slow
     [exec]                       down the server if the output is
suspended. Do
esn't use
     [exec]                       history file.
     [exec]   -r, --raw           Write fields without conversion. Used
with
--b
atch.
     [exec]   --reconnect         Reconnect if the connection is lost.
Disable w
ith
     [exec]                       --disable-reconnect. This option is
enabled by
 default.
     [exec]   -s, --silent        Be more silent. Print results with a
tab
as se
parator,
     [exec]                       each row on new line.
     [exec]   --shared-memory-base-name=name
     [exec]                       Base name of shared memory.
     [exec]   -S, --socket=name   Socket file to use for connection.
     [exec]   --ssl               Enable SSL for connection
(automatically
enabl
ed with
     [exec]                       other flags). Disable with --skip-ssl.
     [exec]   --ssl-ca=name       CA file in PEM format (check OpenSSL
docs,
imp
lies
     [exec]                       --ssl).
     [exec]   --ssl-capath=name   CA directory (check OpenSSL docs,
implies
--ss
l).
     [exec]   --ssl-cert=name     X509 cert in PEM format (implies
--ssl).
     [exec]   --ssl-cipher=name   SSL cipher to use (implies --ssl).
     [exec]   --ssl-key=name      X509 key in PEM format (implies
--ssl).
     [exec]   --ssl-verify-server-cert
     [exec]                       Verify server's "Common Name" in its
cert
agai
nst
     [exec]                       hostname used when connecting. This
option
is
disabled by
     [exec]                       default.
     [exec]   -t, --table         Output in table format.
     [exec]   -T, --debug-info    Print some debug info at exit.
     [exec]   --tee=name          Append everything into outfile. See
interactiv
e help (\h)
     [exec]                       also. Does not work in batch mode.
Disable
wit
h
     [exec]                       --disable-tee. This option is disabled
by
defa
ult.
     [exec]   --no-tee            Disable outfile. See interactive help
(\h)
als
o. WARNING:
     [exec]                       option deprecated; use --disable-tee
instead
     [exec]   -u, --user=name     User for login if not current user.
     [exec]   -U, --safe-updates  Only allow UPDATE and DELETE that uses
keys.
     [exec]   -U, --i-am-a-dummy  Synonym for option --safe-updates, -U.
     [exec]   -v, --verbose       Write more. (-v -v -v gives the table
output f
ormat).
     [exec]   -V, --version       Output version information and exit.
     [exec]   -w, --wait          Wait and retry if connection is down.
     [exec]   --connect_timeout=# Number of seconds before connection
timeout.
     [exec]   --max_allowed_packet=#
     [exec]                       Max packet length to send to, or
receive
from
server
     [exec]   --net_buffer_length=#
     [exec]                       Buffer for TCP/IP and socket
communication
     [exec]   --select_limit=#    Automatic limit for SELECT when using
--safe-u
pdates
     [exec]   --max_join_size=#   Automatic limit for rows in a join
when
using
     [exec]                       --safe-updates
     [exec]   --secure-auth       Refuse client connecting to server if
it
uses
old
     [exec]                       (pre-4.1.1) protocol
     [exec]   --show-warnings     Show warnings after every statement.
     [exec] Default options are read from the following files in the
given
order
:
     [exec] C:\my.ini C:\my.cnf C:\WINDOWS\my.ini C:\WINDOWS\my.cnf
C:\Archivos
de programa\MySQL\MySQL Server 5.0\my.ini C:\Archivos de
programa\MySQL\MySQL Se
rver 5.0\my.cnf
     [exec] The following groups are read: mysql client
     [exec] The following options may be given as the first argument:
     [exec] --print-defaults Print the program argument list and exit
     [exec] --no-defaults  Don't read default options from any options
file
     [exec] --defaults-file=# Only read default options from the given
file
#
     [exec] --defaults-extra-file=# Read this file after the global
files
are re
ad
     [exec] Variables (--variable-name=value)
     [exec] and boolean options {FALSE|TRUE}  Value (after reading
options)
     [exec] ---------------------------------
-----------------------------
     [exec] auto-rehash                       TRUE
     [exec] character-sets-dir                (No default value)
     [exec] default-character-set             latin1
     [exec] compress                          FALSE
     [exec] database                          (No default value)
     [exec] delimiter                         ;
     [exec] vertical                          FALSE
     [exec] force                             FALSE
     [exec] named-commands                    FALSE
     [exec] local-infile                      FALSE
     [exec] no-beep                           FALSE
     [exec] host                              localhost
     [exec] html                              FALSE
     [exec] xml                               FALSE
     [exec] line-numbers                      TRUE
     [exec] unbuffered                        FALSE
     [exec] column-names                      TRUE
     [exec] sigint-ignore                     FALSE
     [exec] port                              3306
     [exec] prompt                            mysql>
     [exec] quick                             FALSE
     [exec] raw                               FALSE
     [exec] reconnect                         FALSE
     [exec] shared-memory-base-name           (No default value)
     [exec] socket                            (No default value)
     [exec] ssl                               FALSE
     [exec] ssl-ca                            (No default value)
     [exec] ssl-capath                        (No default value)
     [exec] ssl-cert                          (No default value)
     [exec] ssl-cipher                        (No default value)
     [exec] ssl-key                           (No default value)
     [exec] ssl-verify-server-cert            FALSE
     [exec] table                             FALSE
     [exec] debug-info                        FALSE
     [exec] user                              root
     [exec] safe-updates                      FALSE
     [exec] i-am-a-dummy                      FALSE
     [exec] connect_timeout                   0
     [exec] max_allowed_packet                16777216
     [exec] net_buffer_length                 16384
     [exec] select_limit                      1000
     [exec] max_join_size                     1000000
     [exec] secure-auth                       FALSE
     [exec] show-warnings                     FALSE

BUILD FAILED

C:\TesisSource\Releases\0.1\SW\l10nCommunity.DataAccess\MySqlDatabase\Co
mmonSqlS
cripts\DataBase.build(21,6):
External Program Failed: mysql (return code was 1)

Total time: 0.3 seconds.


C:\TesisSource\Releases\0.1\SW\l10nCommunity.DataAccess\MySqlDatabase\Co
mmonSqlS
cripts>



r0lan2 wrote:
> 
> Hi,
> I'm trying install a  Mysql database using nant, this is a part of my
> build file:
> <target name="CreateStructure" description="Creating Database" >
>     <exec program="mysql" append="True" verbose="True" commandline="-h
> localhost -u root -pholamundo">
>         <arg value="CreateDataBase.sql" />
>     </exec>
>     <exec program="mysql" append="True" verbose="True"
>               commandline="-h localhost -u root -pholamundo -e source
" >
>       <arg value="Populatelookups.sql" />     
>     </exec> 
>   </target>
> 
> My problem is with: How to put the name of the script to execute ??
> 
> 
> Really, I want execute a command like this:
> 
> mysql -h localhost -u root -pholamundo < Script1.sql
> 
> 
> 
> any commnet or help =) ?
> 
> 
> 
> 

-- 
View this message in context:
http://www.nabble.com/Executing-a-mysql-script-inside-Nant-tp16256023p16
273574.html
Sent from the NAnt - Users mailing list archive at Nabble.com.


------------------------------------------------------------------------
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to