Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
automatic indentation update (r10429-r10457)
git-svn-id: http://svn.osgeo.org/qgis/trunk@10458 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Apr 3, 2009
1 parent 6100301 commit eb10682
Show file tree
Hide file tree
Showing 16 changed files with 1,209 additions and 1,209 deletions.
6 changes: 3 additions & 3 deletions src/app/attributetable/BeataModel.cpp
Expand Up @@ -408,7 +408,7 @@ QVariant BeataModel::data( const QModelIndex &index, int role ) const
mLastRow = ( QgsAttributeMap * ) & mFeat.attributeMap();
}

if( !mLastRow )
if ( !mLastRow )
return QVariant( "ERROR" );

QVariant& val = ( *mLastRow )[ mAttributes[index.column()] ];
Expand Down Expand Up @@ -542,7 +542,7 @@ QVariant BeataMemModel::data( const QModelIndex &index, int role ) const
mLastRow = ( QgsAttributeMap * ) & mFeat.attributeMap();
}

if( !mLastRow )
if ( !mLastRow )
return QVariant( "ERROR" );

QVariant &val = ( *mLastRow )[ mAttributes[index.column()] ];
Expand Down Expand Up @@ -582,7 +582,7 @@ bool BeataMemModel::setData( const QModelIndex &index, const QVariant &value, in
{
mLastRowId = rowToId( index.row() );
mFeat = mFeatureMap[rowToId( index.row() )];
mLastRow = ( QgsAttributeMap * ) &mFeat.attributeMap();
mLastRow = ( QgsAttributeMap * ) & mFeat.attributeMap();


// QgsDebugMsg(mFeatureMap[rowToId(index.row())].id());
Expand Down
210 changes: 105 additions & 105 deletions src/app/ogr/qgsogrhelperfunctions.cpp
@@ -1,105 +1,105 @@
/***************************************************************************
qgsogrhelperfunctions.cpp
helper functions to create ogr uris for database and protocol drivers
-------------------
begin : Mon Jan 2 2009
copyright : (C) 2009 by Godofredo Contreras Nava
email : frdcn at hotmail.com
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/* $Id:$ */

#include "qgsogrhelperfunctions.h"
#include "qgslogger.h"
#include <QRegExp>

QString createDatabaseURI( QString connectionType, QString host, QString database, QString port, QString user, QString password )
{
QString uri = "";
//todo:add default ports for all kind of databases
if (connectionType=="ESRI Personal GeoDatabase")
{
uri="PGeo:"+database;
}
else if (connectionType=="ESRI ArcSDE")
{
if (port.isNull()||port.isEmpty())
port="5151";
uri="SDE:"+host+",PORT:"+port+","+database+","+user+","+password;
}
else if (connectionType=="Informix DataBlade")
{
//not tested
uri="IDB:dbname="+database+" server="+host
+" user="+user
+" pass="+password+" ";
}
else if (connectionType=="INGRES")
{
//not tested
uri="@driver=ingres,dbname="+database+",userid="+user+", password="+password+" ";
}
else if (connectionType=="MySQL")
{
uri="MySQL:"+database+",host="+host
+",port="+port+",user="+user
+", password="+password+" ";
}
else if (connectionType=="Oracle Spatial")
{
uri="OCI:"+user+"/"+password
+"@"+host+"/"+database;
}
else if (connectionType=="ODBC")
{
if(!user.isEmpty())
{
if(password.isEmpty())
{
uri="ODBC:"+user+"@"+database;
}
else
{
uri="ODBC:"+user+"/"+password+"@"+database;
}
}
else
{
uri="ODBC:"+database;
}
}
else if (connectionType=="OGDI Vectors")
{
}
else if (connectionType=="PostgreSQL")
{
uri="PG:dbname='"+database+"' host='"+host
+"' port='"+port+"' user='"+user
+"' password='"+password+"' ";
}
QgsDebugMsg("Connection type is="+connectionType+" and uri="+uri);
return uri;
}


QString createProtocolURI( QString type, QString url )
{
QString uri = "";
if ( type == "GeoJSON" )
{
uri = url;
}
QgsDebugMsg( "Connection type is=" + type + " and uri=" + uri );
return uri;
}
/***************************************************************************
qgsogrhelperfunctions.cpp
helper functions to create ogr uris for database and protocol drivers
-------------------
begin : Mon Jan 2 2009
copyright : (C) 2009 by Godofredo Contreras Nava
email : frdcn at hotmail.com
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/* $Id:$ */

#include "qgsogrhelperfunctions.h"
#include "qgslogger.h"
#include <QRegExp>

QString createDatabaseURI( QString connectionType, QString host, QString database, QString port, QString user, QString password )
{
QString uri = "";
//todo:add default ports for all kind of databases
if ( connectionType == "ESRI Personal GeoDatabase" )
{
uri = "PGeo:" + database;
}
else if ( connectionType == "ESRI ArcSDE" )
{
if ( port.isNull() || port.isEmpty() )
port = "5151";
uri = "SDE:" + host + ",PORT:" + port + "," + database + "," + user + "," + password;
}
else if ( connectionType == "Informix DataBlade" )
{
//not tested
uri = "IDB:dbname=" + database + " server=" + host
+ " user=" + user
+ " pass=" + password + " ";

}
else if ( connectionType == "INGRES" )
{
//not tested
uri = "@driver=ingres,dbname=" + database + ",userid=" + user + ", password=" + password + " ";
}
else if ( connectionType == "MySQL" )
{
uri = "MySQL:" + database + ",host=" + host
+ ",port=" + port + ",user=" + user
+ ", password=" + password + " ";
}
else if ( connectionType == "Oracle Spatial" )
{
uri = "OCI:" + user + "/" + password
+ "@" + host + "/" + database;
}
else if ( connectionType == "ODBC" )
{
if ( !user.isEmpty() )
{
if ( password.isEmpty() )
{
uri = "ODBC:" + user + "@" + database;
}
else
{
uri = "ODBC:" + user + "/" + password + "@" + database;
}

}
else
{
uri = "ODBC:" + database;
}
}
else if ( connectionType == "OGDI Vectors" )
{
}
else if ( connectionType == "PostgreSQL" )
{
uri = "PG:dbname='" + database + "' host='" + host
+ "' port='" + port + "' user='" + user
+ "' password='" + password + "' ";

}
QgsDebugMsg( "Connection type is=" + connectionType + " and uri=" + uri );
return uri;
}


QString createProtocolURI( QString type, QString url )
{
QString uri = "";
if ( type == "GeoJSON" )
{
uri = url;
}
QgsDebugMsg( "Connection type is=" + type + " and uri=" + uri );
return uri;
}
52 changes: 26 additions & 26 deletions src/app/ogr/qgsogrhelperfunctions.h
@@ -1,26 +1,26 @@
/***************************************************************************
qgsogrhelperfunctions.h
helper functions to create ogr uris for database and protocol drivers
-------------------
begin : Mon Jan 2 2009
copyright : (C) 2009 by Godofredo Contreras Nava
email : frdcn at hotmail.com
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/* $Id:$ */

#include <QString>

/* Create database uri from connection parameters */
QString createDatabaseURI(QString connectionType, QString host, QString database, QString port, QString user, QString password);

/* Create protocol uri from connection parameters */
QString createProtocolURI(QString type, QString url);
/***************************************************************************
qgsogrhelperfunctions.h
helper functions to create ogr uris for database and protocol drivers
-------------------
begin : Mon Jan 2 2009
copyright : (C) 2009 by Godofredo Contreras Nava
email : frdcn at hotmail.com
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/* $Id:$ */

#include <QString>

/* Create database uri from connection parameters */
QString createDatabaseURI( QString connectionType, QString host, QString database, QString port, QString user, QString password );

/* Create protocol uri from connection parameters */
QString createProtocolURI( QString type, QString url );

0 comments on commit eb10682

Please sign in to comment.