Sha256: a716bb965484a7c4eb875f183d13b9d5f51d3c5cf24314dff390d44ba14765ad

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

module OGR
  module LayerMixins
    module OGRSQLMethods
      # @return [Boolean]
      def start_transaction
        transact { FFI::OGR::API.OGR_L_StartTransaction(@c_pointer) }
      end

      # @return [Boolean]
      def commit_transaction
        transact { FFI::OGR::API.OGR_L_CommitTransaction(@c_pointer) }
      end

      # @return [Boolean]
      def rollback_transaction
        transact { FFI::OGR::API.OGR_L_RollbackTransaction(@c_pointer) }
      end

      # The name of the underlying database column or "" if not supported.
      #
      # @return [String]
      def fid_column
        FFI::OGR::API.OGR_L_GetFIDColumn(@c_pointer)
      end

      # The name of the underlying database column being used as the geometry
      # column.  Returns "" if not supported.
      #
      # @return [String]
      def geometry_column
        FFI::OGR::API.OGR_L_GetGeometryColumn(@c_pointer)
      end

      private

      # @return [Boolean]
      def transact
        unless supports_transactions?
          raise OGR::UnsupportedOperation, 'This layer does not support transactions.'
        end

        ogr_err = yield

        ogr_err.handle_result
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ffi-gdal-1.0.0.beta7 lib/ogr/layer_mixins/ogr_sql_methods.rb
ffi-gdal-1.0.0.beta6 lib/ogr/layer_mixins/ogr_sql_methods.rb