[Thread Prev][Thread Next][Index]

Re: Constraint "text" concatenation MySQL error



Hi Joe,

TMAPCIMT.pm has been customized from TMAPDBI.pm. I have added what I get in the debug file ($lasroot/server/log) for the database access. The mysql_request.txt file is empty under $lasroot/server/log.

the problem is probably coming from those "commas" in the MySQL request:

ConstraintVal(WODB): "station,=,T101"

Thanks for your help on this.
Jerome.

--- Calling: LAS::Server::Ferret::accessDatabase
database_access prop: lon_domain = -180:180
database_access prop: loca_index = locationID
database_access prop: depth_units = meters
database_access prop: time = cimtLocations.time
database_access prop: db_host = localhost
database_access prop: samp_index = sampleID
database_access prop: time_sample = 2004-01-21 00:00:00
database_access prop: data_table = cimtCTD
database_access prop: loca_table = cimtLocations
database_access prop: timeout = 180
database_access prop: latitude = cimtLocations.latitude
database_access prop: db_type = mysql
database_access prop: db_login = lasctd
database_access prop: db_passwd = lasrules
database_access prop: db_name = CIMT
database_access prop: station = cimtCTD.station
database_access prop: longitude = cimtLocations.longitude
database_access prop: data_index = ctdID
database_access prop: db_title = cimt ctd
database_access prop: time_index = locationID
database_access prop: depth = cimtCTD.depth
database_access prop: dsetname = cimt/ctd
database_access prop: samp_table = cimtSampleLog
database_access prop: lon_domain_hi = 180
database_access prop: lon_domain_lo = -180
method is: insitu_data_cdf
Creating new TMAP::CIMT::Dataset
Constraint: longName == constraint
Constraint: cachedAttributes == hash: ()
Constraint: args == array: ()
Constraint: values == array: (station,=,T101)
Constraint: class == LAS::Constraint::Text
Constraint: children == array: ()
Constraint: config == LAS::Config=HASH(0xa93b784)
Constraint: fullPath == /lasRequest/args/constraint
Constraint: attributes == XML::DOM::NamedNodeMap=HASH(0xa8dd344)
Constraint: element == XML::DOM::Element=ARRAY(0xa8dd224)
ConstraintVal(WODB): "station,=,T101"
getExternalData: calling getData
getExternalData: data read/write error: DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=,T101' at line 6 at ../xml/perl/TMAP/TMAPCIMT.pm line 336.
LAS::Server::Ferret accessDatabase: error: DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=,T101' at line 6 at ../xml/perl/TMAP/TMAPCIMT.pm line 336.



Jerome King
Associate Specialist II
Institute of Marine Sciences
CIMT
Lab phone number: (831) 459-2876.



From: Joe McLean <joe.mclean@noaa.gov>
To: Jerome King <jejeking@hotmail.com>
CC: oar.pmel.las_users@noaa.gov
Subject: Re: Constraint "text" concatenation MySQL error
Date: Fri, 17 Dec 2004 15:25:52 -0800

Hi Jerome,
The formatting of the text constraint from the UI request is done in two places on your product server:
1. the method getTextConstraint($constraint) in $lasroot/xml/perl/TMAP/
2. the method addConstraint(@constraint_values) in your database driver (TMAPCIMT.pm)

TMAPDBI.pm and TMAPJGOFS.pm both set up log files. If you used these as exmples for your driver, you should have a log file in $lasroot/server/log recording the constraint and formatted mysql request after each product (or error) is generated. You can ask for more debugging in the addConstraint method to see what exactly is going on. I might be able to see something if you send me the code for addConstraint from TMAPCIMT.pm

Joe
--------------------------------------

Jerome King wrote:

Hi all,

I am working on customizing LAS with in-situ data such as CTD data. I am trying to add a constraint where users can choose a specific station. There is an example of this in the LAS documentation pages for JGOFS.

http://ferret.pmel.noaa.gov/LASdoc/serve/cache/53.html

I have followed the example but I am encountering a MySQL error.
I believe it's a concatenation error with the <constraint> of type 'text' that ultimately becomes part of the SQL query. It requires three different menus that are presented in a single line in the user interface.

<menu type="constraint" name="CIMT_StationText">
<item values="sta_std">Standard Station</item>
</menu>
<menu type="constraint" name="CIMT_StationOps">
<item values="=">=</item>
<item values="!=">!=</item>
</menu>
<menu type="constraint" name="CIMT_Stations">
<item values="T100">T100</item>
<item values="T101">T101</item>
<item values="T201">T201</item>
<item values="T301">T301</item>
<item values="T401">T401</item>
<item values="T402">T402</item>
<item values="T501">T501</item>
<item values="T601">T601</item>
<item values="T701">T701</item>
<item values="T702">T702</item>
</menu>

The MySQL error I get is:

DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=,T201' at line 6 at ../xml/perl/TMAP/TMAPCIMT.pm line 329.

The constraint appears fine on the interface and station names are listed correctly in the drop down menu. For some reason the concatenation produces '=,T201" instead of 'T201'.

I have triple checked that I am not missing any parts in my cimt_ui.xml.
I really doubt I should modify anything in my TMAPCIMT.pm driver but I am running out of ideas.

I have contacted Cyndy Chandler at JGOFS for some help but she mentioned that Jon Callahan developed that specific part of coding between the LAS and the JGOFS database so she directed me to the LAS forum.

Thanks for any help on this problem,

Jerome King
Associate Specialist II
Institute of Marine Sciences
CIMT
phone number: (831) 459-5007.






[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement