Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 5514 invoked from network); 26 Oct 2006 06:43:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Oct 2006 06:43:09 -0000 Received: (qmail 31724 invoked by uid 500); 25 Oct 2006 08:37:57 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 31639 invoked by uid 500); 25 Oct 2006 08:37:57 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 31558 invoked by uid 99); 25 Oct 2006 08:37:56 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Oct 2006 01:37:56 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of peter.kitt.reilly@gmail.com designates 64.233.182.187 as permitted sender) Received: from [64.233.182.187] (HELO nf-out-0910.google.com) (64.233.182.187) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Oct 2006 01:37:44 -0700 Received: by nf-out-0910.google.com with SMTP id x29so495831nfb for ; Wed, 25 Oct 2006 01:37:23 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=h+mo7RalbDGKYcZIbqb193QDdrRfQnKwdmJcUWH8xduM8Mut+7cS62TQbeaLhA0ctZ7dgYhD5aaU0FKuVQVTn5OoItvgHaiVmTwQ6/7akZ+F8YyJuy1uVK6WN0awYIDseXr1VIpFu2m+8bqzwhInfCfbKWKjEEVq4pK3LFwO+RQ= Received: by 10.48.254.10 with SMTP id b10mr2846000nfi; Wed, 25 Oct 2006 01:37:22 -0700 (PDT) Received: by 10.49.90.10 with HTTP; Wed, 25 Oct 2006 01:37:22 -0700 (PDT) Message-ID: Date: Wed, 25 Oct 2006 09:37:22 +0100 From: "Peter Reilly" To: "Ant Users List" , floess@mindspring.com Subject: Re: Example: error loading a mysqldump file In-Reply-To: <453EC305.3000900@mindspring.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <3585b2e10610241715n5ef7e889jd98ea6095445df5a@mail.gmail.com> <453EBC44.9080903@mindspring.com> <3585b2e10610241832x1a4353abq50776615d5578032@mail.gmail.com> <453EC305.3000900@mindspring.com> X-Virus-Checked: Checked by ClamAV on apache.org SqlExec is full of bugs (see the bugzilla database). Try using keepformat="true" Peter On 10/25/06, Scot P. Floess wrote: > Hunter: > > OK, I see what you are saying now... Sorry :( Apparently I wasn't > paying attention to what you were saying... > > Its odd to me the implementation isn't taking the character stream > verbatim and hading through to JDBC - thus allowing JDBC to parse and do > the right thing...so I guess Ant is parsing (perhaps partially) and then > the JDBC layer gets to parse too? > > The problem I had (again this was probably 3 years ago) was that for any > given line, the line was assumed to contain an entire SQL statement...if > the SQL statement spanned multiple lines, a continuation character had > to be included in the file. > > Scot > > Hunter Peress wrote: > >> It is treating each line as ONE sql statement. By using the -line > >> continuation- character, it should fix the problem - namely the \ > >> character. > > > > > > So? I gave 2 statements each on its own line. the problem is that ant > > thinks > > the > > string inside the first quote is an actual sql comment > > > > the problem is that the ant sql task lacks some parsing: > > from SQLExec.java > > > > // SQL defines "--" as a comment to EOL > > // and in Oracle it may contain a hint > > // so we cannot just remove it, instead we must end it > > if (!keepformat) { > > if (line.indexOf("--") >= 0) { > > sql.append("\n"); > > } > > } > > > > i'm going to hack to make it only parse comments that arent within > > quotes. > > > > > > Placing SQL statements in a file makes perfect sense...perhaps he is > >> trying to put database creation, or population information there? > > > > > > > > > > > > > > I've > >> done it before and I saw no reason why one wouldn't want to do that... > >> > >> And, this isn't an issue of ctrl-M characters... I had this problem on > >> a Linux system using a ViM created file under Linux... Ant is treating > >> the newline as a delimiter for the SQL statement. > >> > >> Martin Gainty wrote: > >> > Hunter > >> > > >> > If Im not mistaken I think you just answered your own question > >> > so when you put all the SQL statements together on one line then > >> ant can > >> parse the SQL > >> > if you break the SQL apart with some varying number of unknown > >> delimiters ant cannot understand your file contents > >> > if you absolutely must use a file(I dont know why you would) > >> > then tell ant what the the SQL statement delimiters are by specifying > >> your own delimiter within the sql task > >> > > >> > Also be wary that Unix does not like nasty ctl-m ^M characters that > >> dos > >> editors toss in as newline endings > >> > vi -b on the sql file will at least show you the whitespace characters > >> so you can delete them > >> > > >> > Martin- > >> > This e-mail communication and any attachments may contain confidential > >> and privileged information for the use of the > >> > designated recipients named above. If you are not the intended > >> recipient, you are hereby notified that you have received > >> > this communication in error and that any review, disclosure, > >> dissemination, distribution or copying of it or its > >> > contents > >> > ----- Original Message ----- > >> > From: "Hunter Peress" > >> > To: "Ant Users List" ; "Martin Gainty" < > >> mgainty@hotmail.com> > >> > Sent: Tuesday, October 24, 2006 8:15 PM > >> > Subject: Example: error loading a mysqldump file > >> > > >> > > >> > > >> >> Ant file: > >> >> >> >> > >> classpath="../lib/mysql-connector-java-3.1.12-bin.jar > >> " > >> >> driver="com.mysql.jdbc.Driver" > >> >> url="jdbc:mysql://localhost:3306/" > >> >> userid="" > >> >> password="" > >> >> print="yes" > >> >> src="wtf.sql" > >> >> > > >> >> use what; > >> >> > >> >> > >> >> wtf.sql: > >> >> insert into properties (value) values(""); > >> >> insert into properties (value) values("Hi"); > >> >> > >> >> Ok so if in mysql console you source wtf.sql there are no > >> problems, its > >> >> valid mysql. But ant bombs on it. > >> >> Ant can handle each line ,but put them together in a file and its > >> bad. > >> >> > >> >> > >> >> On 10/24/06, Martin Gainty wrote: > >> >> > >> >>> I know if I edit on windo and port to nix I will have > >> appended at > >> >>> end of each line > >> >>> for small files > >> >>> vi -b > >> >>> will show you the extra CR and you can easily delete the CR (which > >> show up > >> >>> as ^M) chars > >> >>> > >> >>> for comprehensive treatment of entire files to unix run the > >> dostounix > >> >>> utility > >> >>> check out this link from the friendly folk from Santa Cruz for > >> details > >> >>> http://people.ucsc.edu/~chengyus/CE12L/DOSTOUNIX.htm > >> >>> > >> >>> Martin -- > >> >>> > >> >>> This e-mail communication and any attachments may contain > >> confidential > >> and > >> >>> privileged information for the use of the > >> >>> designated recipients named above. If you are not the intended > >> recipient, > >> >>> you are hereby notified that you have received > >> >>> this communication in error and that any review, disclosure, > >> >>> dissemination, distribution or copying of it or its > >> >>> contents > >> >>> ----- Original Message ----- > >> >>> From: "Scot P. Floess" > >> >>> To: "Ant Users List" > >> >>> Sent: Tuesday, October 24, 2006 10:03 AM > >> >>> Subject: Re: error loading a mysqldump file > >> >>> > >> >>> > >> >>> > >> >>>> Can you elaborate more on the error? > >> >>>> > >> >>>> Some years ago I was using the sql task and had a file full of SQL > >> >>>> statements... When I tried to use the sql task I was getting > >> errors > >> as > >> >>>> well. The solution, if memory serves, is that I had to use a \ > >> >>>> character at the end of each line until SQL termination. So, if I > >> had > >> >>>> something like: > >> >>>> > >> >>>> create table foo > >> >>>> ( > >> >>>> bar as int > >> >>>> ); > >> >>>> > >> >>>> I had to do this kind of thing: > >> >>>> > >> >>>> create table foo \ > >> >>>> ( \ > >> >>>> bar as int \ > >> >>>> ); > >> >>>> > >> >>>> The problem (again if I can remember correctly) was that each line > >> >>>> (meaning new line/carriage return) was being interpreted as the > >> "whole" > >> >>>> sql statement and submitted. > >> >>>> Hunter Peress wrote: > >> >>>> > >> >>>>> using the sql task's src attribute i source a mysqldump file > >> and it > >> >>>>> errors. > >> >>>>> mysql can source the file with no problems. > >> >>>>> but in ant I source it and theres a syntax error. > >> >>>>> There is no delimiter being set in the source. > >> >>>>> also if take individually two insert statement and source those it > >> >>>>> > >> >>> works. > >> >>> > >> >>>>> but i combine them and i get a syntax error. > >> >>>>> > >> >>>>> in the mysqldump the text fields are xml documents so they have > >> almost > >> >>>>> every > >> >>>>> imagineable character. > >> >>>>> > >> >>>>> im using standard utf8 encoding. any ideas? > >> >>>>> > >> >>>>> > >> >>>> -- > >> >>>> Scot P. Floess > >> >>>> 27 Lake Royale > >> >>>> Louisburg, NC 27549 > >> >>>> > >> >>>> 252-478-8087 (Home) > >> >>>> 919-754-4592 (Work) > >> >>>> > >> >>>> Chief Architect JPlate http://sourceforge.net/projects/jplate > >> >>>> Chief Architect JavaPIM http://sourceforge.net/projects/javapim > >> >>>> > >> >>>> > >> >>>> > >> --------------------------------------------------------------------- > >> >>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org > >> >>>> For additional commands, e-mail: user-help@ant.apache.org > >> >>>> > >> >>>> > >> >>>> > >> > > > >> > >> -- > >> Scot P. Floess > >> 27 Lake Royale > >> Louisburg, NC 27549 > >> > >> 252-478-8087 (Home) > >> 919-754-4592 (Work) > >> > >> Chief Architect JPlate http://sourceforge.net/projects/jplate > >> Chief Architect JavaPIM http://sourceforge.net/projects/javapim > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org > >> For additional commands, e-mail: user-help@ant.apache.org > >> > >> > > > > -- > Scot P. Floess > 27 Lake Royale > Louisburg, NC 27549 > > 252-478-8087 (Home) > 919-754-4592 (Work) > > Chief Architect JPlate http://sourceforge.net/projects/jplate > Chief Architect JavaPIM http://sourceforge.net/projects/javapim > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org > For additional commands, e-mail: user-help@ant.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org