connect - ActiveState ActiveGo 1.8
...

Package connect

import "gopkg.in/rana/ora.v4/examples/connect"
Overview
Index

Overview ▾

Copyright 2013 Tamás Gulácsi

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

func DescribeQuery

func DescribeQuery(db dber.Execer, qry string) ([]Column, error)

DescribeQuery describes the columns in the qry string, using DBMS_SQL.PARSE + DBMS_SQL.DESCRIBE_COLUMNS2.

This can help using unknown-at-compile-time, a.k.a. dynamic queries.

func GetCfg

func GetCfg(dsn string) (srvCfg *ora.SrvCfg, sesCfg *ora.SesCfg)

GetDSN returns a (command-line defined) connection string

func GetConnection

func GetConnection(dsn string) (*sql.DB, error)

GetConnection returns a connection - using GetDSN if dsn is empty

func GetDSN

func GetDSN(srvCfg *ora.SrvCfg, sesCfg *ora.SesCfg) string

func GetRawConnection

func GetRawConnection(dsn string) (*ora.Ses, error)

GetRawConnection returns a raw (*ora.Ses) connection - using GetDSN if dsn is empty

func MapToSlice

func MapToSlice(qry string, metParam func(string) interface{}) (string, []interface{})

MapToSlice modifies query for map (:paramname) to :%d placeholders + slice of params.

Calls metParam for each parameter met, and returns the slice of their results.

func SplitDSN

func SplitDSN(dsn string) (username, password, sid string)

SplitDSN splits the username/password@sid string to its parts.

Copied from github.com/tgulacsi/go/orahlp/orahlp.go

type Column

type Column struct {
    Schema, Name                   string
    Type, Length, Precision, Scale int
    Nullable                       bool
    CharsetID, CharsetForm         int
}

type Version

type Version struct {
    // major.maintenance.application-server.component-specific.platform-specific
    Major, Maintenance, AppServer, Component, Platform int8
}

func GetVersion

func GetVersion(db dber.Queryer) (Version, error)