-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
automatic indentation update (r10429-r10457)
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10458 c8812cc2-4d05-0410-92ff-de0c093fc19c
- Loading branch information
jef
committed
Apr 3, 2009
1 parent
10e4a7f
commit ab05841
Showing
16 changed files
with
1,209 additions
and
1,209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ); |
Oops, something went wrong.