fix
parent
d1b5b3b92c
commit
d6927858df
8
db/db.go
8
db/db.go
|
@ -1,6 +1,8 @@
|
||||||
package db
|
package db
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"git.botann.com/lijun/sql-builder/util"
|
"git.botann.com/lijun/sql-builder/util"
|
||||||
"git.botann.com/tinycs/boomerang/tydb"
|
"git.botann.com/tinycs/boomerang/tydb"
|
||||||
"git.botann.com/tinycs/boomerang/tyoracle"
|
"git.botann.com/tinycs/boomerang/tyoracle"
|
||||||
|
@ -34,6 +36,12 @@ func (s *SqlBuilder[T]) Clear() {
|
||||||
s.Opts = Options{}
|
s.Opts = Options{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *SqlBuilder[T]) SetSchema(schema string) {
|
||||||
|
if s.Driver == util.DriverOracle {
|
||||||
|
tyoracle.DB().Exec(fmt.Sprintf("ALTER SESSION SET CURRENT_SCHEMA = %s", schema), nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (s *SqlBuilder[T]) SetDriver(driver string) {
|
func (s *SqlBuilder[T]) SetDriver(driver string) {
|
||||||
s.Driver = driver
|
s.Driver = driver
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,137 +0,0 @@
|
||||||
Your use of this Program is governed by the Oracle Free Distribution, Hosting,
|
|
||||||
and Use Terms and Conditions set forth below, unless you have received this
|
|
||||||
Program (alone or as part of another Oracle product) under an Oracle license
|
|
||||||
agreement (including but not limited to the Oracle Master Agreement), in which
|
|
||||||
case your use of this Program is governed solely by such license agreement with
|
|
||||||
Oracle.
|
|
||||||
|
|
||||||
Oracle Free Distribution, Hosting, and Use Terms and Conditions
|
|
||||||
|
|
||||||
Definitions
|
|
||||||
|
|
||||||
"Oracle" refers to Oracle America, Inc. "You" and "Your" refers to (a) a
|
|
||||||
company or organization (each an "Entity") accessing the Programs, if use of
|
|
||||||
the Programs will be on behalf of such Entity; or (b) an individual accessing
|
|
||||||
the Programs, if use of the Programs will not be on behalf of an
|
|
||||||
Entity. "Program(s)" refers to Oracle software provided by Oracle pursuant to
|
|
||||||
the following terms and any updates, error corrections, and/or Program
|
|
||||||
Documentation provided by Oracle. "Program Documentation" refers to Program
|
|
||||||
user manuals and Program installation manuals, if any. If available, Program
|
|
||||||
Documentation may be delivered with the Programs and/or may be accessed from
|
|
||||||
www.oracle.com/documentation. "Separate Terms" refers to separate license terms
|
|
||||||
that are specified in the Program Documentation, readmes or notice files and
|
|
||||||
that apply to Separately Licensed Technology. "Separately Licensed Technology"
|
|
||||||
refers to Oracle or third party technology that is licensed under Separate
|
|
||||||
Terms and not under the terms of this license.
|
|
||||||
|
|
||||||
Separately Licensed Technology
|
|
||||||
|
|
||||||
Oracle may provide certain notices to You in Program Documentation, readmes or
|
|
||||||
notice files in connection with Oracle or third party technology provided as or
|
|
||||||
with the Programs. If specified in the Program Documentation, readmes or notice
|
|
||||||
files, such technology will be licensed to You under Separate Terms. Your
|
|
||||||
rights to use Separately Licensed Technology under Separate Terms are not
|
|
||||||
restricted in any way by the terms herein. For clarity, notwithstanding the
|
|
||||||
existence of a notice, third party technology that is not Separately Licensed
|
|
||||||
Technology shall be deemed part of the Programs licensed to You under the terms
|
|
||||||
of this license.
|
|
||||||
|
|
||||||
Source Code for Open Source Software
|
|
||||||
|
|
||||||
For software that You receive from Oracle in binary form that is licensed under
|
|
||||||
an open source license that gives You the right to receive the source code for
|
|
||||||
that binary, You can obtain a copy of the applicable source code from
|
|
||||||
https://oss.oracle.com/sources/ or
|
|
||||||
http://www.oracle.com/goto/opensourcecode. If the source code for such software
|
|
||||||
was not provided to You with the binary, You can also receive a copy of the
|
|
||||||
source code on physical media by submitting a written request pursuant to the
|
|
||||||
instructions in the "Written Offer for Source Code" section of the latter
|
|
||||||
website.
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
The following license terms apply to those Programs that are not provided to
|
|
||||||
You under Separate Terms.
|
|
||||||
|
|
||||||
License Rights and Restrictions
|
|
||||||
|
|
||||||
Oracle grants to You, as a recipient of this Program, a nonexclusive,
|
|
||||||
nontransferable, limited license to, subject to the conditions stated herein,
|
|
||||||
use the unmodified Programs, including, without limitation, for the purposes
|
|
||||||
of:
|
|
||||||
|
|
||||||
- developing, testing, prototyping and demonstrating applications;
|
|
||||||
|
|
||||||
- running the unmodified Programs for training, personal use, your business
|
|
||||||
operations, and the business operations of third parties;
|
|
||||||
|
|
||||||
- making the unmodified Programs available for use by third parties in your
|
|
||||||
hosted environment and in cloud services;
|
|
||||||
|
|
||||||
- redistributing unmodified Programs and Programs Documentation under the terms
|
|
||||||
of this License; and
|
|
||||||
|
|
||||||
- copying the unmodified Programs and Program Documentation to the extent
|
|
||||||
reasonably necessary to exercise the license rights granted herein and for
|
|
||||||
backup purposes.
|
|
||||||
|
|
||||||
For the purposes of this license, compiling, interpreting or configuring an
|
|
||||||
otherwise unmodified Program as necessary to run the Program shall not be
|
|
||||||
considered modification.
|
|
||||||
|
|
||||||
Your license is contingent on Your compliance with the following conditions:
|
|
||||||
|
|
||||||
- You include a copy of this license with any distribution by You of the
|
|
||||||
Programs;
|
|
||||||
|
|
||||||
- You do not charge your customers, end users, distributees or other third
|
|
||||||
parties any additional fees for the distribution or use of the Programs;
|
|
||||||
however, for clarity, if you comply with the foregoing condition,
|
|
||||||
distribution or use of the Program as part of your for-fee product or service
|
|
||||||
that adds substantial additional value is permitted;
|
|
||||||
|
|
||||||
- You do not remove markings or notices of either Oracle's or a licensor's
|
|
||||||
proprietary rights from the Programs or Program Documentation;
|
|
||||||
|
|
||||||
- You comply with all U.S. and applicable export control and economic sanctions
|
|
||||||
laws and regulations that govern Your use of the Programs (including
|
|
||||||
technical data); and
|
|
||||||
|
|
||||||
- You do not cause or permit reverse engineering, disassembly or decompilation
|
|
||||||
of the Programs (except as allowed by law) by You nor allow an associated
|
|
||||||
party to do so.
|
|
||||||
|
|
||||||
Any source code that may be included in the distribution with the Programs may
|
|
||||||
not be modified, unless such source code is under Separate Terms permitting
|
|
||||||
modification.
|
|
||||||
|
|
||||||
Ownership
|
|
||||||
|
|
||||||
Oracle or its licensors retain all ownership and intellectual property rights
|
|
||||||
to the Programs.
|
|
||||||
|
|
||||||
Information Collection
|
|
||||||
|
|
||||||
The Programs' installation and/or auto-update processes, if any, may transmit a
|
|
||||||
limited amount of data to Oracle or its service provider about those processes
|
|
||||||
to help Oracle understand and optimize them. Oracle does not associate the data
|
|
||||||
with personally identifiable information. Refer to Oracle's Privacy Policy at
|
|
||||||
www.oracle.com/privacy.
|
|
||||||
|
|
||||||
Disclaimer of Warranties; Limitation of Liability
|
|
||||||
|
|
||||||
THE PROGRAMS ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ORACLE FURTHER
|
|
||||||
DISCLAIMS ALL WARRANTIES, EXPRESS AND IMPLIED, INCLUDING WITHOUT LIMITATION,
|
|
||||||
ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
|
|
||||||
NONINFRINGEMENT.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL ORACLE BE LIABLE TO YOU FOR
|
|
||||||
DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
|
|
||||||
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT
|
|
||||||
LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED
|
|
||||||
BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
|
||||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGES.
|
|
||||||
|
|
||||||
Version 1.0
|
|
||||||
Last updated: 28 June 2022
|
|
|
@ -1,19 +0,0 @@
|
||||||
Basic Package Information
|
|
||||||
=========================
|
|
||||||
|
|
||||||
Thu 11 Jul 2024 23:58:50 PDT
|
|
||||||
|
|
||||||
Client Shared Library 64-bit - 23.3.0.23.09
|
|
||||||
|
|
||||||
System name: Darwin
|
|
||||||
Release: 22.6.0
|
|
||||||
Version: Darwin Kernel Version 22.6.0: Mon Feb 19 19:43:41 PST 2024; root:xnu-8796.141.3.704.6~1/RELEASE_ARM64_T8103
|
|
||||||
Machine: arm64
|
|
||||||
|
|
||||||
TIMEZONE INFORMATION
|
|
||||||
--------------------
|
|
||||||
Operating in ORACLE_HOME environment.
|
|
||||||
|
|
||||||
Small timezone file = timezone_43.dat
|
|
||||||
Large timezone file = timezlrg_43.dat
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1 +0,0 @@
|
||||||
libclntsh.dylib.23.1
|
|
|
@ -1 +0,0 @@
|
||||||
libclntsh.dylib.23.1
|
|
|
@ -1 +0,0 @@
|
||||||
libclntsh.dylib.23.1
|
|
|
@ -1 +0,0 @@
|
||||||
libclntsh.dylib.23.1
|
|
|
@ -1 +0,0 @@
|
||||||
libclntsh.dylib.23.1
|
|
|
@ -1 +0,0 @@
|
||||||
libclntsh.dylib.23.1
|
|
|
@ -1 +0,0 @@
|
||||||
libclntsh.dylib.23.1
|
|
|
@ -1 +0,0 @@
|
||||||
libclntsh.dylib.23.1
|
|
|
@ -1 +0,0 @@
|
||||||
libclntsh.dylib.23.1
|
|
Binary file not shown.
|
@ -1 +0,0 @@
|
||||||
libclntshcore.dylib.23.1
|
|
|
@ -1 +0,0 @@
|
||||||
libclntshcore.dylib.23.1
|
|
|
@ -1 +0,0 @@
|
||||||
libclntshcore.dylib.23.1
|
|
|
@ -1 +0,0 @@
|
||||||
libclntshcore.dylib.23.1
|
|
|
@ -1 +0,0 @@
|
||||||
libclntshcore.dylib.23.1
|
|
|
@ -1 +0,0 @@
|
||||||
libclntshcore.dylib.23.1
|
|
|
@ -1 +0,0 @@
|
||||||
libclntshcore.dylib.23.1
|
|
Binary file not shown.
Binary file not shown.
|
@ -1 +0,0 @@
|
||||||
libocci.dylib.23.1
|
|
|
@ -1 +0,0 @@
|
||||||
libocci.dylib.23.1
|
|
|
@ -1 +0,0 @@
|
||||||
libocci.dylib.23.1
|
|
|
@ -1 +0,0 @@
|
||||||
libocci.dylib.23.1
|
|
|
@ -1 +0,0 @@
|
||||||
libocci.dylib.23.1
|
|
|
@ -1 +0,0 @@
|
||||||
libocci.dylib.23.1
|
|
|
@ -1 +0,0 @@
|
||||||
libocci.dylib.23.1
|
|
|
@ -1 +0,0 @@
|
||||||
libocci.dylib.23.1
|
|
|
@ -1 +0,0 @@
|
||||||
libocci.dylib.23.1
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,9 +0,0 @@
|
||||||
============================================================================
|
|
||||||
This is the default directory for Oracle Network and Oracle Client
|
|
||||||
configuration files. You can place files such as tnsnames.ora, sqlnet.ora
|
|
||||||
and oraaccess.xml in this directory.
|
|
||||||
NOTE:
|
|
||||||
If you set an environment variable TNS_ADMIN to another directory containing
|
|
||||||
configuration files, they will be used instead of the files in this default
|
|
||||||
directory.
|
|
||||||
============================================================================
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
35
main_test.go
35
main_test.go
|
@ -69,24 +69,25 @@ func TestMain(m *testing.M) {
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
Rn int
|
Rn int
|
||||||
}
|
}
|
||||||
var data []PreliminaryProcedureResponse
|
// var data []PreliminaryProcedureResponse
|
||||||
// var data []Employye
|
var data []Employye
|
||||||
// company_id := 1
|
// company_id := 1
|
||||||
sqlb := DefaultSqlBuilder()
|
// sqlb := DefaultSqlBuilder()
|
||||||
// sqlb := OracleSqlBuilder()
|
sqlb := OracleSqlBuilder()
|
||||||
sqls := `select t1.autoseq,max(t1.establishment_time),max(t1.number),max(t1.name),max(t2.name) as project_unit,max(t3.name) as project_type,
|
sqlb.SetSchema("HR")
|
||||||
count(distinct t6.autoseq) all_num,
|
// sqls := `select t1.autoseq,max(t1.establishment_time),max(t1.number),max(t1.name),max(t2.name) as project_unit,max(t3.name) as project_type,
|
||||||
count(distinct case t6.state when 1 then t6.autoseq end) not_handle_num,
|
// count(distinct t6.autoseq) all_num,
|
||||||
count(distinct case t6.state when 2 then t6.autoseq end) no_handle_num,
|
// count(distinct case t6.state when 1 then t6.autoseq end) not_handle_num,
|
||||||
count(distinct case t6.state when 3 then t6.autoseq end) handling_num,
|
// count(distinct case t6.state when 2 then t6.autoseq end) no_handle_num,
|
||||||
count(distinct case t6.state when 4 then t6.autoseq end) handled_num
|
// count(distinct case t6.state when 3 then t6.autoseq end) handling_num,
|
||||||
from tproject_info t1
|
// count(distinct case t6.state when 4 then t6.autoseq end) handled_num
|
||||||
inner join tcompany t2 on t1.investor_id = t2.autoseq and t2.del = 0 @c
|
// from tproject_info t1
|
||||||
left join tinvestment_type t3 on t1.industry_category_id = t3.autoseq and t3.del = 0
|
// inner join tcompany t2 on t1.investor_id = t2.autoseq and t2.del = 0 @c
|
||||||
left join tpreliminary_procedures t6 on t1.autoseq = t6.project_id
|
// left join tinvestment_type t3 on t1.industry_category_id = t3.autoseq and t3.del = 0
|
||||||
where t1.del = 0 @c @c @c @c @c1
|
// left join tpreliminary_procedures t6 on t1.autoseq = t6.project_id
|
||||||
@g`
|
// where t1.del = 0 @c @c @c @c @c1
|
||||||
// sqls := `select employee_id,first_name,last_name,email from HR.employees`
|
// @g`
|
||||||
|
sqls := `select employee_id,first_name,last_name,email from employees`
|
||||||
sqlb.Sql = sqls
|
sqlb.Sql = sqls
|
||||||
// if company_id != 0 {
|
// if company_id != 0 {
|
||||||
// sqlb.InsertConditions("@c1", "t2.autoseq = ?", company_id)
|
// sqlb.InsertConditions("@c1", "t2.autoseq = ?", company_id)
|
||||||
|
|
Loading…
Reference in New Issue