Coder Social home page Coder Social logo

cartodbclient-php's Introduction

IMPORTANT

This library is deprecated and isn't going to be updated anymore. Please, take in consideration using the CartoDB SQL API instead, whose documentation is available here.

If you have any questions don't hesitate to send us an email to [email protected].

cartodbclient-php's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cartodbclient-php's Issues

Update function issues

I would suggest making these changes to the update function. Remove the lastID since this is an update statement and is not needed. Also adding single quotes to the values so that it does not crash on string values.

  public function updateRow($table, $row_id, $data) {
    $keys = implode(',', array_keys($data));
    $values = implode('\',\'', array_values($data));
    $sql = "UPDATE $table SET ($keys) = ('$values') WHERE cartodb_id = $row_id;";
#    $sql .= "SELECT $table.cartodb_id as id, $table.* FROM $table ";
#    $sql .= "WHERE cartodb_id = currval('public." . $table . "_cartodb_id_seq');";
    return $this->runSql($sql);
  }

Escaping Strings with Single Quotes

Hi,

I'm using this php client and I want to insert some new data records into my CartoDB table which contain single-quotes. I have seen, that the classes don't provide any solutions for this yet, so I'm trying to work out my own escaping solution.

As discussed here, a simple Backspace-Escape should work for single quotes (and from what I know this usually works fine):
http://support.cartodb.com/discussions/problems/50-problem-with-apostrophe

But something seems to get messed up anyway and I just get a syntax error.

Here's the query I'm passing to the runSql Function:

INSERT INTO handel_v2 (the_geom,crm_id,firma) VALUES(GEOMETRYFROMTEXT('POINT(3.7941725 41.9231994)', 4326),'internal ID','Name with' single-quote');
SELECT handel_v2.cartodb_id as id, handel_v2.* FROM handel_v2 WHERE cartodb_id = currval('public.handel_v2_cartodb_id_seq');

Any Ideas? (Anything else I can provide to track this down?)
Thanks!
M

Check OAuthException exists before declaring

A number of other libraries and code bases already declare an OAuthException exception class causing a Fatal error: Cannot redeclare class OAuthException notice.

PR #9 wraps it in a if (!class_exists('OAuthException')) to prevent the fatal error if it already has been declared.

runSql() exception incorrectly handles error message for CartoDB errors

The exception thrown by CartoDBClient::runSql() doesn't return a valid message string, at least when the error is a SQL error.

In that case, the CartoDB response is an array, which runSql() tries to concatenate onto the Exception message.

Suggest testing for HTTP response 400 and adjusting the error message accordingly.

Will follow with patch, rolled against HEAD, relative to cartodbclient-php directory.

Api v2 support?

dropTables and getTables are not working for me. I checked the API and in my account it lists v2. The top of this class is /api/v1/. Maybe that's why?

When I do a createTable after my dropTable failed, using the same name instead of resulting in an error I get a magical new table with the name and "_1" or "_2" depending on how many times it has happened. I think it would make a lot more sense to return an error in case of a name collision and have the user handle that scenario. That doesn't belong here per se but I haven't found where it happens in the cartodb repo.

Missing License information

First of all, really nice library :)
I've tested it and looks like it work nice, but I'm missing some Licensing information to understand how I can integrate it on my project.

Typo in cartodb.class.php

You have:

require_once 'carto.config.php'; on line 22.

I think this should be:

require_once 'cartodb.config.php';

null

SB/5423933

The tables appear in the dashboard right after they're created and then disappear.

Double issue with client

I'm getting these two errors after setting up my config file and testing a query:

PHP Warning: Invalid argument supplied for foreach() in /mypath/cartodb.class.php on line 39

PHP Fatal error: Class 'OAuthSignatureMethod_HMAC_SHA1' not found in /mypath/cartodb.class.php on line 268

What could be causing these?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.