Skip to content
Browse files

Removed spatial types

  • Loading branch information...
1 parent 2182ea5 commit 6f023fb018ecbbc27d582babd1b40bdd0be856fc @gabordemooij committed Oct 27, 2012
View
1 RedBean/OODB.php
@@ -446,7 +446,6 @@ private function storeBean(RedBean_OODBBean $bean) {
$cast = false;
//What kind of property are we dealing with?
$typeno = $this->writer->scanType($v,true);
- $v = $this->writer->getValue();
}
//Is this property represented in the table?
if (isset($columns[$this->writer->safeColumn($p,true)])) {
View
39 RedBean/QueryWriter/MySQL.php
@@ -102,17 +102,7 @@ class RedBean_QueryWriter_MySQL extends RedBean_QueryWriter_AQueryWriter impleme
*/
const C_DATATYPE_SPECIFIED = 99;
- /**
- * Spatial types
- * @var integer
- */
- const C_DATATYPE_SPECIAL_POINT = 100;
- const C_DATATYPE_SPECIAL_LINESTRING = 101;
- const C_DATATYPE_SPECIAL_GEOMETRY = 102;
- const C_DATATYPE_SPECIAL_POLYGON = 103;
- const C_DATATYPE_SPECIAL_MULTIPOINT = 104;
- const C_DATATYPE_SPECIAL_MULTIPOLYGON = 105;
- const C_DATATYPE_SPECIAL_GEOMETRYCOLLECTION = 106;
+
/**
* Holds the RedBean Database Adapter.
@@ -145,14 +135,7 @@ public function __construct( RedBean_Adapter $adapter ) {
RedBean_QueryWriter_MySQL::C_DATATYPE_TEXT32=>' LONGTEXT ',
RedBean_QueryWriter_MySQL::C_DATATYPE_SPECIAL_DATE=>' DATE ',
RedBean_QueryWriter_MySQL::C_DATATYPE_SPECIAL_DATETIME=>' DATETIME ',
- RedBean_QueryWriter_MySQL::C_DATATYPE_SPECIAL_POINT=>' POINT ',
- RedBean_QueryWriter_MySQL::C_DATATYPE_SPECIAL_LINESTRING=>' LINESTRING ',
- RedBean_QueryWriter_MySQL::C_DATATYPE_SPECIAL_GEOMETRY=>' GEOMETRY ',
- RedBean_QueryWriter_MySQL::C_DATATYPE_SPECIAL_POLYGON=>' POLYGON ',
- RedBean_QueryWriter_MySQL::C_DATATYPE_SPECIAL_MULTIPOINT=>' MULTIPOINT ',
- RedBean_QueryWriter_MySQL::C_DATATYPE_SPECIAL_MULTIPOLYGON=>' MULTIPOLYGON ',
- RedBean_QueryWriter_MySQL::C_DATATYPE_SPECIAL_GEOMETRYCOLLECTION=>' GEOMETRYCOLLECTION ',
- );
+ );
$this->sqltype_typeno = array();
foreach($this->typeno_sqltype as $k=>$v)
@@ -232,24 +215,6 @@ public function scanType( $value, $flagSpecial=false ) {
}
if ($flagSpecial) {
- if (strpos($value,'POINT(')===0) {
- $this->svalue = $this->adapter->getCell('SELECT GeomFromText(?)',array($value));
- return RedBean_QueryWriter_MySQL::C_DATATYPE_SPECIAL_POINT;
- }
- if (strpos($value,'LINESTRING(')===0) {
- $this->svalue = $this->adapter->getCell('SELECT GeomFromText(?)',array($value));
- return RedBean_QueryWriter_MySQL::C_DATATYPE_SPECIAL_LINESTRING;
- }
- if (strpos($value,'POLYGON(')===0) {
- $this->svalue = $this->adapter->getCell('SELECT GeomFromText(?)',array($value));
- return RedBean_QueryWriter_MySQL::C_DATATYPE_SPECIAL_POLYGON;
- }
- if (strpos($value,'MULTIPOINT(')===0) {
- $this->svalue = $this->adapter->getCell('SELECT GeomFromText(?)',array($value));
- return RedBean_QueryWriter_MySQL::C_DATATYPE_SPECIAL_MULTIPOINT;
- }
-
-
if (preg_match('/^\d{4}\-\d\d-\d\d$/',$value)) {
return RedBean_QueryWriter_MySQL::C_DATATYPE_SPECIAL_DATE;
}
View
35 RedBean/QueryWriter/PostgreSQL.php
@@ -47,13 +47,6 @@ class RedBean_QueryWriter_PostgreSQL extends RedBean_QueryWriter_AQueryWriter im
*/
const C_DATATYPE_SPECIAL_DATETIME = 81;
- const C_DATATYPE_SPECIAL_POINT = 101;
- const C_DATATYPE_SPECIAL_LINE = 102;
- const C_DATATYPE_SPECIAL_LSEG = 103;
- const C_DATATYPE_SPECIAL_BOX = 104;
- const C_DATATYPE_SPECIAL_CIRCLE = 105;
- const C_DATATYPE_SPECIAL_POLYGON = 106;
-
/**
@@ -117,12 +110,7 @@ public function __construct( RedBean_Adapter $adapter ) {
self::C_DATATYPE_TEXT=>' text ',
self::C_DATATYPE_SPECIAL_DATE => ' date ',
self::C_DATATYPE_SPECIAL_DATETIME => ' timestamp without time zone ',
- self::C_DATATYPE_SPECIAL_POINT => ' point ',
- self::C_DATATYPE_SPECIAL_LINE => ' line ',
- self::C_DATATYPE_SPECIAL_LSEG => ' lseg ',
- self::C_DATATYPE_SPECIAL_BOX => ' box ',
- self::C_DATATYPE_SPECIAL_CIRCLE => ' circle ',
- self::C_DATATYPE_SPECIAL_POLYGON => ' polygon ',
+
);
@@ -191,26 +179,7 @@ public function scanType( $value, $flagSpecial=false ) {
if (preg_match('/^\d{4}\-\d\d-\d\d\s\d\d:\d\d:\d\d(\.\d{1,6})?$/',$value)) {
return RedBean_QueryWriter_PostgreSQL::C_DATATYPE_SPECIAL_DATETIME;
}
- if (strpos($value,'POINT(')===0) {
- $this->svalue = str_replace('POINT','',$value);
- return RedBean_QueryWriter_PostgreSQL::C_DATATYPE_SPECIAL_POINT;
- }
- if (strpos($value,'LSEG(')===0) {
- $this->svalue = str_replace('LSEG','',$value);
- return RedBean_QueryWriter_PostgreSQL::C_DATATYPE_SPECIAL_LSEG;
- }
- if (strpos($value,'BOX(')===0) {
- $this->svalue = str_replace('BOX','',$value);
- return RedBean_QueryWriter_PostgreSQL::C_DATATYPE_SPECIAL_BOX;
- }
- if (strpos($value,'CIRCLE(')===0) {
- $this->svalue = str_replace('CIRCLE','',$value);
- return RedBean_QueryWriter_PostgreSQL::C_DATATYPE_SPECIAL_CIRCLE;
- }
- if (strpos($value,'POLYGON(')===0) {
- $this->svalue = str_replace('POLYGON','',$value);
- return RedBean_QueryWriter_PostgreSQL::C_DATATYPE_SPECIAL_POLYGON;
- }
+
}
$sz = ($this->startsWithZeros($value));
View
11 testing/RedUNIT/Mysql/Writer.php
@@ -63,8 +63,6 @@ public function run() {
asrt($writer->scanType("2001-10-10 10:00:00",true),RedBean_QueryWriter_MySQL::C_DATATYPE_SPECIAL_DATETIME);
asrt($writer->scanType("2001-10-10"),4);
asrt($writer->scanType("2001-10-10 10:00:00"),4);
- asrt($writer->scanType("POINT(1 2)",true),RedBean_QueryWriter_MySQL::C_DATATYPE_SPECIAL_POINT);
- asrt($writer->scanType("POINT(1 2)"),4);
asrt($writer->scanType(str_repeat("lorem ipsum",100)),5);
$writer->widenColumn("testtable", "c1", 2);
$cols=$writer->getColumns("testtable");
@@ -281,14 +279,7 @@ public function run() {
$cols = R::getColumns('bean');
asrt($cols['date'],'datetime');
$bean = R::dispense('bean');
- //$bean->date = 'soon';
- //R::store($bean);
- //$cols = R::getColumns('bean');
- //asrt($cols['date'],'datetime');
- $this->setGetSpatial('POINT(1 2)');
- $this->setGetSpatial('LINESTRING(3 3,4 4)');
- $this->setGetSpatial('POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7,5 5))');
- $this->setGetSpatial('MULTIPOINT(0 0,20 20,60 60)');
+
try{
$bean = R::dispense('bean');
View
41 testing/RedUNIT/Postgres/Writer.php
@@ -155,46 +155,7 @@ public function run() {
pass();
testpack('Special data types');
-
- R::nuke();
- $bean = R::dispense('bean');
- $bean->location = "POINT(3,3)";
- $id = R::store($bean);
- $bean =R::load('bean',$id);
- $cols = R::getColumns('bean');
- asrt($cols['location'],'point');
-
- R::nuke();
- $bean = R::dispense('bean');
- $bean->location = "LSEG((3,3),(4,4))";
- $id = R::store($bean);
- $bean =R::load('bean',$id);
- $cols = R::getColumns('bean');
- asrt($cols['location'],'lseg');
-
- R::nuke();
- $bean = R::dispense('bean');
- $bean->location = "BOX((3,3),(4,4))";
- $id = R::store($bean);
- $bean =R::load('bean',$id);
- $cols = R::getColumns('bean');
- asrt($cols['location'],'box');
-
- R::nuke();
- $bean = R::dispense('bean');
- $bean->location = "CIRCLE((3,3),10)";
- $id = R::store($bean);
- $bean =R::load('bean',$id);
- $cols = R::getColumns('bean');
- asrt($cols['location'],'circle');
-
- R::nuke();
- $bean = R::dispense('bean');
- $bean->location = "POLYGON((1,1),(1,10),(10,10),(10,1),(1,1))";
- $id = R::store($bean);
- $bean =R::load('bean',$id);
- $cols = R::getColumns('bean');
- asrt($cols['location'],'polygon');
+
R::nuke();
$bean = R::dispense('bean');

0 comments on commit 6f023fb

Please sign in to comment.
Something went wrong with that request. Please try again.