Rosso69 / storelocator

Automatically exported from code.google.com/p/storelocator
0 stars 0 forks source link

mySQL data instead of CSV #15

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The examples use data contained in a CSV file, however i want to be able to use 
data from a mySQL database. 

Instead of using the 'rudimentary CSV parsing' method in the examples, how can 
I pull the data from my tables into an array and make use of them in the map?

I'm assuming this is the key area which needs changing;

MedicareDataSource.prototype.parse_ = function(csv) {
  var stores = [];
  var rows = csv.split('\n');
  var headings = this.parseRow_(rows[0]);

  for (var i = 1, row; row = rows[i]; i++) {
    row = this.toObject_(headings, this.parseRow_(row));
    var features = new storeLocator.FeatureSet;
    features.add(this.FEATURES_.getById('Wheelchair-' + row.Wheelchair));
    features.add(this.FEATURES_.getById('Audio-' + row.Audio));

    var position = new google.maps.LatLng(row.Ycoord, row.Xcoord);

    var shop = this.join_([row.Shp_num_an, row.Shp_centre], ', ');
    var locality = this.join_([row.Locality, row.Postcode], ', ');

    var store = new storeLocator.Store(row.uuid, position, features, {
      title: row.Fcilty_nam,
      address: this.join_([shop, row.Street_add, locality], '<br>'),
      hours: row.Hrs_of_bus
    });
    stores.push(store);
  }
  return stores;
};

Original issue reported on code.google.com by benjido...@gmail.com on 14 May 2013 at 1:42