/
oracle.go
49 lines (41 loc) · 1.25 KB
/
oracle.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
// Package oracle implements gdb.Driver, which supports operations for database Oracle.
//
// Note:
// 1. It does not support Save/Replace features.
// 2. It does not support LastInsertId.
package oracle
import (
"github.com/gogf/gf/v2/database/gdb"
)
// Driver is the driver for oracle database.
type Driver struct {
*gdb.Core
}
const (
quoteChar = `"`
)
func init() {
if err := gdb.Register(`oracle`, New()); err != nil {
panic(err)
}
}
// New create and returns a driver that implements gdb.Driver, which supports operations for Oracle.
func New() gdb.Driver {
return &Driver{}
}
// New creates and returns a database object for oracle.
// It implements the interface of gdb.Driver for extra database driver installation.
func (d *Driver) New(core *gdb.Core, node *gdb.ConfigNode) (gdb.DB, error) {
return &Driver{
Core: core,
}, nil
}
// GetChars returns the security char for this type of database.
func (d *Driver) GetChars() (charLeft string, charRight string) {
return quoteChar, quoteChar
}