1 /* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD
2 * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
3 * full text of the license. */
6 * @requires OpenLayers/Protocol.js
10 * Class: OpenLayers.Protocol.SQL
11 * Abstract SQL protocol class. Not to be instantiated directly. Use
12 * one of the SQL protocol subclasses instead.
15 * - <OpenLayers.Protocol>
17 OpenLayers.Protocol.SQL = OpenLayers.Class(OpenLayers.Protocol, {
20 * APIProperty: databaseName
26 * APIProperty: tableName
27 * Name of the database table into which Features should be saved.
29 tableName: "ol_vector_features",
32 * Property: postReadFiltering
33 * {Boolean} Whether the filter (if there's one) must be applied after
34 * the features have been read from the database; for example the
35 * BBOX strategy passes the read method a BBOX spatial filter, if
36 * postReadFiltering is true every feature read from the database
37 * will go through the BBOX spatial filter, which can be costly;
40 postReadFiltering: true,
43 * Constructor: OpenLayers.Protocol.SQL
45 initialize: function(options) {
46 OpenLayers.Protocol.prototype.initialize.apply(this, [options]);
51 * Clean up the protocol.
54 OpenLayers.Protocol.prototype.destroy.apply(this);
58 * APIMethod: supported
59 * This should be overridden by specific subclasses
62 * {Boolean} Whether or not the browser supports the SQL backend
64 supported: function() {
69 * Method: evaluateFilter
70 * If postReadFiltering is true evaluate the filter against the feature
71 * and return the result of the evaluation, otherwise return true.
74 * {<OpenLayers.Feature.Vector>} The feature.
75 * {<OpenLayers.Filter>} The filter.
78 * {Boolean} true if postReadFiltering if false, the result of the
79 * filter evaluation otherwise.
81 evaluateFilter: function(feature, filter) {
82 return filter && this.postReadFiltering ?
83 filter.evaluate(feature) : true;
86 CLASS_NAME: "OpenLayers.Protocol.SQL"