1
/******************************************************************************
2
* $Id: ogrmssqlspatialdriver.cpp 20570 2010-09-11 20:40:59Z tamas $
4
* Project: MSSQL Spatial driver
5
* Purpose: Definition of classes for OGR MSSQL Spatial driver.
6
* Author: Tamas Szekeres, szekerest at gmail.com
8
******************************************************************************
9
* Copyright (c) 2010, Tamas Szekeres
11
* Permission is hereby granted, free of charge, to any person obtaining a
12
* copy of this software and associated documentation files (the "Software"),
13
* to deal in the Software without restriction, including without limitation
14
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
15
* and/or sell copies of the Software, and to permit persons to whom the
16
* Software is furnished to do so, subject to the following conditions:
18
* The above copyright notice and this permission notice shall be included
19
* in all copies or substantial portions of the Software.
21
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27
* DEALINGS IN THE SOFTWARE.
28
****************************************************************************/
30
#include "ogr_mssqlspatial.h"
33
CPL_CVSID("$Id: ogrmssqlspatialdriver.cpp 20570 2010-09-11 20:40:59Z tamas $");
35
/************************************************************************/
36
/* ~OGRMSSQLSpatialDriver() */
37
/************************************************************************/
39
OGRMSSQLSpatialDriver::~OGRMSSQLSpatialDriver()
44
/************************************************************************/
46
/************************************************************************/
48
const char *OGRMSSQLSpatialDriver::GetName()
51
return "MSSQLSpatial";
54
/************************************************************************/
56
/************************************************************************/
58
OGRDataSource *OGRMSSQLSpatialDriver::Open( const char * pszFilename, int bUpdate )
61
OGRMSSQLSpatialDataSource *poDS;
63
if( !EQUALN(pszFilename,"MSSQL:",6) )
66
poDS = new OGRMSSQLSpatialDataSource();
68
if( !poDS->Open( pszFilename, bUpdate, TRUE ) )
77
/************************************************************************/
78
/* CreateDataSource() */
79
/************************************************************************/
81
OGRDataSource *OGRMSSQLSpatialDriver::CreateDataSource( const char * pszName,
85
OGRMSSQLSpatialDataSource *poDS = new OGRMSSQLSpatialDataSource();
87
if( !EQUALN(pszName,"MSSQL:",6) )
90
if( !poDS->Open( pszName, TRUE, TRUE ) )
93
CPLError( CE_Failure, CPLE_AppDefined,
94
"MSSQL Spatial driver doesn't currently support database creation.\n"
95
"Please create database with the Microsoft SQL Server Client Tools." );
102
/************************************************************************/
103
/* TestCapability() */
104
/************************************************************************/
106
int OGRMSSQLSpatialDriver::TestCapability( const char * pszCap )
109
if( EQUAL(pszCap,ODrCCreateDataSource) )
116
/************************************************************************/
117
/* RegisterOGRMSSQLSpatial() */
118
/************************************************************************/
120
void RegisterOGRMSSQLSpatial()
123
if (! GDAL_CHECK_VERSION("OGR/MSSQLSpatial driver"))
125
OGRSFDriverRegistrar::GetRegistrar()->RegisterDriver( new OGRMSSQLSpatialDriver );