mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
also applied postgis provider changes to head. Removed a bug in ogrprovider which sometimes caused crashes when selecting
git-svn-id: http://svn.osgeo.org/qgis/trunk@3907 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
c3a98b4cfc
commit
d9c4137ae0
@ -394,7 +394,6 @@ QgsFeature *QgsOgrProvider::getNextFeature(bool fetchAttributes)
|
||||
continue;
|
||||
} */
|
||||
}
|
||||
delete fet;
|
||||
|
||||
if(mUseIntersect)
|
||||
{
|
||||
|
@ -1672,14 +1672,23 @@ bool QgsPostgresProvider::addFeature(QgsFeature* f, int primaryKeyHighWater)
|
||||
unsigned char* geom=f->getGeometry();
|
||||
for(int i=0;i<f->getGeometrySize();++i)
|
||||
{
|
||||
QString hex=QString::number((int)geom[i],16).upper();
|
||||
if(hex.length()==1)
|
||||
{
|
||||
hex="0"+hex;
|
||||
}
|
||||
insert+=hex;
|
||||
//Postgis 1.0 wants bytea instead of hex
|
||||
QString oct = QString::number((int)geom[i], 8);
|
||||
if(oct.length()==3)
|
||||
{
|
||||
oct="\\\\"+oct;
|
||||
}
|
||||
else if(oct.length()==1)
|
||||
{
|
||||
oct="\\\\00"+oct;
|
||||
}
|
||||
else if(oct.length()==2)
|
||||
{
|
||||
oct="\\\\0"+oct;
|
||||
}
|
||||
insert+=oct;
|
||||
}
|
||||
insert+="',"+srid+")";
|
||||
insert+="::bytea',"+srid+")";
|
||||
|
||||
//add the primary key value to the insert statement
|
||||
insert += ",";
|
||||
@ -2049,14 +2058,23 @@ bool QgsPostgresProvider::changeGeometryValues(std::map<int, QgsGeometry> & geom
|
||||
|
||||
for (int i=0; i < iter->second.wkbSize(); ++i)
|
||||
{
|
||||
QString hex=QString::number( (int)geom[i], 16 ).upper();
|
||||
if(hex.length()==1)
|
||||
{
|
||||
hex="0"+hex;
|
||||
}
|
||||
sql += hex;
|
||||
//Postgis 1.0 wants bytea instead of hex
|
||||
QString oct = QString::number((int)geom[i], 8);
|
||||
if(oct.length()==3)
|
||||
{
|
||||
oct="\\\\"+oct;
|
||||
}
|
||||
else if(oct.length()==1)
|
||||
{
|
||||
oct="\\\\00"+oct;
|
||||
}
|
||||
else if(oct.length()==2)
|
||||
{
|
||||
oct="\\\\0"+oct;
|
||||
}
|
||||
sql += oct;
|
||||
}
|
||||
sql += "',"+srid+")";
|
||||
sql+="::bytea',"+srid+")";
|
||||
|
||||
sql += " WHERE " +
|
||||
primaryKey + "=" + QString::number( iter->first );
|
||||
|
Loading…
x
Reference in New Issue
Block a user