diff --git a/db/db.go b/db/db.go index 1c495e6..5030b48 100644 --- a/db/db.go +++ b/db/db.go @@ -1,6 +1,8 @@ package db import ( + "fmt" + "git.botann.com/lijun/sql-builder/util" "git.botann.com/tinycs/boomerang/tydb" "git.botann.com/tinycs/boomerang/tyoracle" @@ -34,6 +36,12 @@ func (s *SqlBuilder[T]) Clear() { 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) { s.Driver = driver } diff --git a/instantclient_23_3/BASIC_LICENSE b/instantclient_23_3/BASIC_LICENSE deleted file mode 100644 index 9d16991..0000000 --- a/instantclient_23_3/BASIC_LICENSE +++ /dev/null @@ -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 diff --git a/instantclient_23_3/BASIC_README b/instantclient_23_3/BASIC_README deleted file mode 100644 index ccce006..0000000 --- a/instantclient_23_3/BASIC_README +++ /dev/null @@ -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 - diff --git a/instantclient_23_3/adrci b/instantclient_23_3/adrci deleted file mode 100755 index fe57ef1..0000000 Binary files a/instantclient_23_3/adrci and /dev/null differ diff --git a/instantclient_23_3/fips.dylib b/instantclient_23_3/fips.dylib deleted file mode 100755 index 9373072..0000000 Binary files a/instantclient_23_3/fips.dylib and /dev/null differ diff --git a/instantclient_23_3/genezi b/instantclient_23_3/genezi deleted file mode 100755 index 9b54f1c..0000000 Binary files a/instantclient_23_3/genezi and /dev/null differ diff --git a/instantclient_23_3/legacy.dylib b/instantclient_23_3/legacy.dylib deleted file mode 100755 index 5f2581a..0000000 Binary files a/instantclient_23_3/legacy.dylib and /dev/null differ diff --git a/instantclient_23_3/libclntsh.dylib b/instantclient_23_3/libclntsh.dylib deleted file mode 120000 index 52b9155..0000000 --- a/instantclient_23_3/libclntsh.dylib +++ /dev/null @@ -1 +0,0 @@ -libclntsh.dylib.23.1 \ No newline at end of file diff --git a/instantclient_23_3/libclntsh.dylib.10.1 b/instantclient_23_3/libclntsh.dylib.10.1 deleted file mode 120000 index 52b9155..0000000 --- a/instantclient_23_3/libclntsh.dylib.10.1 +++ /dev/null @@ -1 +0,0 @@ -libclntsh.dylib.23.1 \ No newline at end of file diff --git a/instantclient_23_3/libclntsh.dylib.11.1 b/instantclient_23_3/libclntsh.dylib.11.1 deleted file mode 120000 index 52b9155..0000000 --- a/instantclient_23_3/libclntsh.dylib.11.1 +++ /dev/null @@ -1 +0,0 @@ -libclntsh.dylib.23.1 \ No newline at end of file diff --git a/instantclient_23_3/libclntsh.dylib.12.1 b/instantclient_23_3/libclntsh.dylib.12.1 deleted file mode 120000 index 52b9155..0000000 --- a/instantclient_23_3/libclntsh.dylib.12.1 +++ /dev/null @@ -1 +0,0 @@ -libclntsh.dylib.23.1 \ No newline at end of file diff --git a/instantclient_23_3/libclntsh.dylib.18.1 b/instantclient_23_3/libclntsh.dylib.18.1 deleted file mode 120000 index 52b9155..0000000 --- a/instantclient_23_3/libclntsh.dylib.18.1 +++ /dev/null @@ -1 +0,0 @@ -libclntsh.dylib.23.1 \ No newline at end of file diff --git a/instantclient_23_3/libclntsh.dylib.19.1 b/instantclient_23_3/libclntsh.dylib.19.1 deleted file mode 120000 index 52b9155..0000000 --- a/instantclient_23_3/libclntsh.dylib.19.1 +++ /dev/null @@ -1 +0,0 @@ -libclntsh.dylib.23.1 \ No newline at end of file diff --git a/instantclient_23_3/libclntsh.dylib.20.1 b/instantclient_23_3/libclntsh.dylib.20.1 deleted file mode 120000 index 52b9155..0000000 --- a/instantclient_23_3/libclntsh.dylib.20.1 +++ /dev/null @@ -1 +0,0 @@ -libclntsh.dylib.23.1 \ No newline at end of file diff --git a/instantclient_23_3/libclntsh.dylib.21.1 b/instantclient_23_3/libclntsh.dylib.21.1 deleted file mode 120000 index 52b9155..0000000 --- a/instantclient_23_3/libclntsh.dylib.21.1 +++ /dev/null @@ -1 +0,0 @@ -libclntsh.dylib.23.1 \ No newline at end of file diff --git a/instantclient_23_3/libclntsh.dylib.22.1 b/instantclient_23_3/libclntsh.dylib.22.1 deleted file mode 120000 index 52b9155..0000000 --- a/instantclient_23_3/libclntsh.dylib.22.1 +++ /dev/null @@ -1 +0,0 @@ -libclntsh.dylib.23.1 \ No newline at end of file diff --git a/instantclient_23_3/libclntsh.dylib.23.1 b/instantclient_23_3/libclntsh.dylib.23.1 deleted file mode 100755 index a84f7d1..0000000 Binary files a/instantclient_23_3/libclntsh.dylib.23.1 and /dev/null differ diff --git a/instantclient_23_3/libclntshcore.dylib b/instantclient_23_3/libclntshcore.dylib deleted file mode 120000 index 94fd12f..0000000 --- a/instantclient_23_3/libclntshcore.dylib +++ /dev/null @@ -1 +0,0 @@ -libclntshcore.dylib.23.1 \ No newline at end of file diff --git a/instantclient_23_3/libclntshcore.dylib.12.1 b/instantclient_23_3/libclntshcore.dylib.12.1 deleted file mode 120000 index 94fd12f..0000000 --- a/instantclient_23_3/libclntshcore.dylib.12.1 +++ /dev/null @@ -1 +0,0 @@ -libclntshcore.dylib.23.1 \ No newline at end of file diff --git a/instantclient_23_3/libclntshcore.dylib.18.1 b/instantclient_23_3/libclntshcore.dylib.18.1 deleted file mode 120000 index 94fd12f..0000000 --- a/instantclient_23_3/libclntshcore.dylib.18.1 +++ /dev/null @@ -1 +0,0 @@ -libclntshcore.dylib.23.1 \ No newline at end of file diff --git a/instantclient_23_3/libclntshcore.dylib.19.1 b/instantclient_23_3/libclntshcore.dylib.19.1 deleted file mode 120000 index 94fd12f..0000000 --- a/instantclient_23_3/libclntshcore.dylib.19.1 +++ /dev/null @@ -1 +0,0 @@ -libclntshcore.dylib.23.1 \ No newline at end of file diff --git a/instantclient_23_3/libclntshcore.dylib.20.1 b/instantclient_23_3/libclntshcore.dylib.20.1 deleted file mode 120000 index 94fd12f..0000000 --- a/instantclient_23_3/libclntshcore.dylib.20.1 +++ /dev/null @@ -1 +0,0 @@ -libclntshcore.dylib.23.1 \ No newline at end of file diff --git a/instantclient_23_3/libclntshcore.dylib.21.1 b/instantclient_23_3/libclntshcore.dylib.21.1 deleted file mode 120000 index 94fd12f..0000000 --- a/instantclient_23_3/libclntshcore.dylib.21.1 +++ /dev/null @@ -1 +0,0 @@ -libclntshcore.dylib.23.1 \ No newline at end of file diff --git a/instantclient_23_3/libclntshcore.dylib.22.1 b/instantclient_23_3/libclntshcore.dylib.22.1 deleted file mode 120000 index 94fd12f..0000000 --- a/instantclient_23_3/libclntshcore.dylib.22.1 +++ /dev/null @@ -1 +0,0 @@ -libclntshcore.dylib.23.1 \ No newline at end of file diff --git a/instantclient_23_3/libclntshcore.dylib.23.1 b/instantclient_23_3/libclntshcore.dylib.23.1 deleted file mode 100755 index 6651939..0000000 Binary files a/instantclient_23_3/libclntshcore.dylib.23.1 and /dev/null differ diff --git a/instantclient_23_3/libnnz.dylib b/instantclient_23_3/libnnz.dylib deleted file mode 100755 index 3e2d2f1..0000000 Binary files a/instantclient_23_3/libnnz.dylib and /dev/null differ diff --git a/instantclient_23_3/libocci.dylib b/instantclient_23_3/libocci.dylib deleted file mode 120000 index e990e5e..0000000 --- a/instantclient_23_3/libocci.dylib +++ /dev/null @@ -1 +0,0 @@ -libocci.dylib.23.1 \ No newline at end of file diff --git a/instantclient_23_3/libocci.dylib.10.1 b/instantclient_23_3/libocci.dylib.10.1 deleted file mode 120000 index e990e5e..0000000 --- a/instantclient_23_3/libocci.dylib.10.1 +++ /dev/null @@ -1 +0,0 @@ -libocci.dylib.23.1 \ No newline at end of file diff --git a/instantclient_23_3/libocci.dylib.11.1 b/instantclient_23_3/libocci.dylib.11.1 deleted file mode 120000 index e990e5e..0000000 --- a/instantclient_23_3/libocci.dylib.11.1 +++ /dev/null @@ -1 +0,0 @@ -libocci.dylib.23.1 \ No newline at end of file diff --git a/instantclient_23_3/libocci.dylib.12.1 b/instantclient_23_3/libocci.dylib.12.1 deleted file mode 120000 index e990e5e..0000000 --- a/instantclient_23_3/libocci.dylib.12.1 +++ /dev/null @@ -1 +0,0 @@ -libocci.dylib.23.1 \ No newline at end of file diff --git a/instantclient_23_3/libocci.dylib.18.1 b/instantclient_23_3/libocci.dylib.18.1 deleted file mode 120000 index e990e5e..0000000 --- a/instantclient_23_3/libocci.dylib.18.1 +++ /dev/null @@ -1 +0,0 @@ -libocci.dylib.23.1 \ No newline at end of file diff --git a/instantclient_23_3/libocci.dylib.19.1 b/instantclient_23_3/libocci.dylib.19.1 deleted file mode 120000 index e990e5e..0000000 --- a/instantclient_23_3/libocci.dylib.19.1 +++ /dev/null @@ -1 +0,0 @@ -libocci.dylib.23.1 \ No newline at end of file diff --git a/instantclient_23_3/libocci.dylib.20.1 b/instantclient_23_3/libocci.dylib.20.1 deleted file mode 120000 index e990e5e..0000000 --- a/instantclient_23_3/libocci.dylib.20.1 +++ /dev/null @@ -1 +0,0 @@ -libocci.dylib.23.1 \ No newline at end of file diff --git a/instantclient_23_3/libocci.dylib.21.1 b/instantclient_23_3/libocci.dylib.21.1 deleted file mode 120000 index e990e5e..0000000 --- a/instantclient_23_3/libocci.dylib.21.1 +++ /dev/null @@ -1 +0,0 @@ -libocci.dylib.23.1 \ No newline at end of file diff --git a/instantclient_23_3/libocci.dylib.22.1 b/instantclient_23_3/libocci.dylib.22.1 deleted file mode 120000 index e990e5e..0000000 --- a/instantclient_23_3/libocci.dylib.22.1 +++ /dev/null @@ -1 +0,0 @@ -libocci.dylib.23.1 \ No newline at end of file diff --git a/instantclient_23_3/libocci.dylib.23.1 b/instantclient_23_3/libocci.dylib.23.1 deleted file mode 100755 index ee82943..0000000 Binary files a/instantclient_23_3/libocci.dylib.23.1 and /dev/null differ diff --git a/instantclient_23_3/libociei.dylib b/instantclient_23_3/libociei.dylib deleted file mode 100755 index 8a824a0..0000000 Binary files a/instantclient_23_3/libociei.dylib and /dev/null differ diff --git a/instantclient_23_3/libocijdbc23.dylib b/instantclient_23_3/libocijdbc23.dylib deleted file mode 100755 index 80ffd32..0000000 Binary files a/instantclient_23_3/libocijdbc23.dylib and /dev/null differ diff --git a/instantclient_23_3/network/admin/README b/instantclient_23_3/network/admin/README deleted file mode 100644 index 9949ed1..0000000 --- a/instantclient_23_3/network/admin/README +++ /dev/null @@ -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. -============================================================================ diff --git a/instantclient_23_3/ojdbc11.jar b/instantclient_23_3/ojdbc11.jar deleted file mode 100644 index fa33fab..0000000 Binary files a/instantclient_23_3/ojdbc11.jar and /dev/null differ diff --git a/instantclient_23_3/ojdbc8.jar b/instantclient_23_3/ojdbc8.jar deleted file mode 100644 index f1b3de2..0000000 Binary files a/instantclient_23_3/ojdbc8.jar and /dev/null differ diff --git a/instantclient_23_3/pkcs11.dylib b/instantclient_23_3/pkcs11.dylib deleted file mode 100755 index 09b84ff..0000000 Binary files a/instantclient_23_3/pkcs11.dylib and /dev/null differ diff --git a/instantclient_23_3/ucp.jar b/instantclient_23_3/ucp.jar deleted file mode 100644 index e65c477..0000000 Binary files a/instantclient_23_3/ucp.jar and /dev/null differ diff --git a/instantclient_23_3/uidrvci b/instantclient_23_3/uidrvci deleted file mode 100755 index d291842..0000000 Binary files a/instantclient_23_3/uidrvci and /dev/null differ diff --git a/instantclient_23_3/xstreams.jar b/instantclient_23_3/xstreams.jar deleted file mode 100644 index cc30345..0000000 Binary files a/instantclient_23_3/xstreams.jar and /dev/null differ diff --git a/main_test.go b/main_test.go index 959eb76..84bbb57 100644 --- a/main_test.go +++ b/main_test.go @@ -69,24 +69,25 @@ func TestMain(m *testing.M) { Email string `json:"email"` Rn int } - var data []PreliminaryProcedureResponse - // var data []Employye + // var data []PreliminaryProcedureResponse + var data []Employye // company_id := 1 - sqlb := DefaultSqlBuilder() - // 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, - count(distinct t6.autoseq) all_num, - count(distinct case t6.state when 1 then t6.autoseq end) not_handle_num, - count(distinct case t6.state when 2 then t6.autoseq end) no_handle_num, - count(distinct case t6.state when 3 then t6.autoseq end) handling_num, - count(distinct case t6.state when 4 then t6.autoseq end) handled_num - from tproject_info t1 - inner join tcompany t2 on t1.investor_id = t2.autoseq and t2.del = 0 @c - left join tinvestment_type t3 on t1.industry_category_id = t3.autoseq and t3.del = 0 - left join tpreliminary_procedures t6 on t1.autoseq = t6.project_id - where t1.del = 0 @c @c @c @c @c1 - @g` - // sqls := `select employee_id,first_name,last_name,email from HR.employees` + // sqlb := DefaultSqlBuilder() + sqlb := OracleSqlBuilder() + sqlb.SetSchema("HR") + // 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 t6.autoseq) all_num, + // count(distinct case t6.state when 1 then t6.autoseq end) not_handle_num, + // count(distinct case t6.state when 2 then t6.autoseq end) no_handle_num, + // count(distinct case t6.state when 3 then t6.autoseq end) handling_num, + // count(distinct case t6.state when 4 then t6.autoseq end) handled_num + // from tproject_info t1 + // inner join tcompany t2 on t1.investor_id = t2.autoseq and t2.del = 0 @c + // left join tinvestment_type t3 on t1.industry_category_id = t3.autoseq and t3.del = 0 + // left join tpreliminary_procedures t6 on t1.autoseq = t6.project_id + // where t1.del = 0 @c @c @c @c @c1 + // @g` + sqls := `select employee_id,first_name,last_name,email from employees` sqlb.Sql = sqls // if company_id != 0 { // sqlb.InsertConditions("@c1", "t2.autoseq = ?", company_id)