Hi all,
Querying a MySQL database that holds XML string (mediumtext) in one row i have the following problem: ((OrbeonHandler default getDBStringForInstanceDefinitionWithId: 'a3ec41f08d058b4021a75c1689c8451daf1cc1fd' version: 1) subStrings: String tab) last This answer a XML string but it has "/n" character in it, for example: <xh:head>\n <xh:title>Migration 1</xh:title>\n Instead of: <xh:head> <xh:title>Migration 1</xh:title> Querying MySQL inside Linux the "/n" is NOT present --> it seems that is added by #_performOnServer: primitive. Is this right ? Any way i workaround the problem by: myProblematicString copyReplaceAll: '\n' with: Character lf. Is this correct way to handle this ? I tried with GRCodec by no luck... regards, bruno |
Bruno,
Are you saying that the literal string '\n' is present in the result string produced by a #performOnServer:? If so, I don't think that #performOnServer: is the culprit ... the '\n' is being added somewhere else in the stack ... either on the linux end (what command do use in #performOnServer:) ... replacing LF with '\n' seems to be an XMLish thing to do... Dale On 10/16/2015 09:49 AM, BrunoBB via Glass wrote: > Hi all, > > Querying a MySQL database that holds XML string (mediumtext) in one row i > have the following problem: > > ((OrbeonHandler default > getDBStringForInstanceDefinitionWithId: > 'a3ec41f08d058b4021a75c1689c8451daf1cc1fd' version: 1) subStrings: String > tab) last > > This answer a XML string but it has "/n" character in it, for example: > <xh:head>\n <xh:title>Migration 1</xh:title>\n > > Instead of: > <xh:head> > <xh:title>Migration 1</xh:title> > > Querying MySQL inside Linux the "/n" is NOT present --> it seems that is > added by #_performOnServer: primitive. Is this right ? > > Any way i workaround the problem by: > myProblematicString copyReplaceAll: '\n' with: Character lf. > > Is this correct way to handle this ? > > I tried with GRCodec by no luck... > > regards, > bruno > > > > > > -- > View this message in context: http://forum.world.st/System-performOnServer-to-get-MySQL-data-tp4856061.html > Sent from the GLASS mailing list archive at Nabble.com. > _______________________________________________ > Glass mailing list > [hidden email] > http://lists.gemtalksystems.com/mailman/listinfo/glass _______________________________________________ Glass mailing list [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass |
Dale,
Thanks for the answer. The linux command is like: System performOnServer: 'mysql -h 192.168.29.129 -u orbeon -ppwd -N -B -e "select xml from (SELECT xml FROM orbeon.orbeon_form_data where xml is not null and app=''orbeon'' and form=''builder'' and document_id = ''a3ec41f08d058b4021a75c1689c8451daf1cc1fd'' order by last_modified_time desc) lastDef limit 1; " ' The answer is: <xh:head>\n <xh:title>Migration 1</xh:title>\n <xf:model id="fr-form-model" xxf:expose-xpath-types="true">\n\n \n Inside linux and mysql: mysql -u orbeon -ppwd If i execute the same sql sentence i do not see the "\n". Regards, Bruno |
On 10/16/2015 10:52 AM, BrunoBB via Glass wrote: > Dale, > > Thanks for the answer. The linux command is like: > System performOnServer: > 'mysql -h 192.168.29.129 -u orbeon -ppwd -N -B -e "select xml from (SELECT > xml FROM orbeon.orbeon_form_data where xml is not null and app=''orbeon'' > and form=''builder'' and document_id = > ''a3ec41f08d058b4021a75c1689c8451daf1cc1fd'' order by last_modified_time > desc) lastDef limit 1; " ' > > The answer is: > <xh:head>\n <xh:title>Migration 1</xh:title>\n <xf:model > id="fr-form-model" xxf:expose-xpath-types="true">\n\n \n > > Inside linux and mysql: > mysql -u orbeon -ppwd > > If i execute the same sql sentence i do not see the "\n". > I've talked to our vm guy and the #performOnServer: is not replacing linefeeds with the string '\n', , so the '\n' is coming from somewhere else .... either the `mysql ....` is detecting that you are not running in an interactive shell or something else ... but the #performOnServer: is not the source of the '\n' characters ... Dale _______________________________________________ Glass mailing list [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass |
Dale,
I think "\n" are inserted by Bash. System performOnServer: 'mysql -h 192.168.29.129 -u orbeon -ppwd -N -B -e "select TRIM(TRAILING ''\n'' FROM xml) as field from orbeon.orbeon_form_data where xml is not null and app=''orbeon'' and form=''builder'' and document_id = ''a3ec41f08d058b4021a75c1689c8451daf1cc1fd'' order by last_modified_time desc limit 1; " | tr ''\\n'' '' '' ' Here "\n" is removed :) But i will use the Smalltalk workaround because of MySQL SET GLOBAL sql_mode = 'NO_BACKSLASH_ESCAPES'; if set "\\n" is correct if not set "\n" is correct Regards, Bruno |
Oh good, I'm glad we've got that straightened out!
Dale On 10/16/2015 12:01 PM, BrunoBB via Glass wrote: > Dale, > > I think "\n" are inserted by Bash. > > System performOnServer: > 'mysql -h 192.168.29.129 -u orbeon -ppwd -N -B -e "select TRIM(TRAILING > ''\n'' FROM xml) as field from orbeon.orbeon_form_data where xml is not null > and app=''orbeon'' and form=''builder'' and > document_id = ''a3ec41f08d058b4021a75c1689c8451daf1cc1fd'' order by > last_modified_time desc limit 1; " | tr ''\\n'' '' '' ' > > Here "\n" is removed :) > > But i will use the Smalltalk workaround because of MySQL > SET GLOBAL sql_mode = 'NO_BACKSLASH_ESCAPES'; > if set "\\n" is correct > if not set "\n" is correct > > Regards, > Bruno > > > > -- > View this message in context: http://forum.world.st/System-performOnServer-to-get-MySQL-data-tp4856061p4856089.html > Sent from the GLASS mailing list archive at Nabble.com. > _______________________________________________ > Glass mailing list > [hidden email] > http://lists.gemtalksystems.com/mailman/listinfo/glass _______________________________________________ Glass mailing list [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass |
Free forum by Nabble | Edit this page |