Giter VIP home page Giter VIP logo

Comments (4)

sijms avatar sijms commented on August 27, 2024

I fix in next release

from go-ora.

sijms avatar sijms commented on August 27, 2024

there is an issue related to xorm.io

Write packet:
00000000  00 00 00 63 06 00 00 00  00 00 03 5e 00 02 80 21  |...c.......^...!|
00000010  00 01 01 16 01 01 0d 00  00 00 00 04 3f ff ff ff  |............?...|
00000020  00 00 00 00 00 00 00 00  00 00 00 01 00 00 00 00  |................|
00000030  00 00 00 00 00 00 00 00  00 00 00 16 44 52 4f 50  |............DROP|
00000040  20 54 41 42 4c 45 20 60  49 53 53 55 45 5f 33 36  | TABLE `ISSUE_36|
00000050  33 60 01 01 01 01 00 00  00 00 00 00 00 02 80 00  |3`..............|
00000060  00 00 00                                          |...|

table name is surround with back quote
which produce error

00000000  00 00 00 55 06 20 00 00  00 00 04 01 02 01 1f 00  |...U. ..........|
00000010  02 03 8f 00 00 01 06 01  0b 00 00 00 00 00 00 03  |................|
00000020  02 14 93 00 00 02 9a cf  01 01 00 00 00 00 00 00  |................|
00000030  00 00 00 02 03 8f 00 1d  4f 52 41 2d 30 30 39 31  |........ORA-0091|
00000040  31 3a 20 69 6e 76 61 6c  69 64 20 63 68 61 72 61  |1: invalid chara|
00000050  63 74 65 72 0a                                    |cter.|
2023-05-12T20:09:12.9623: Summary: RetCode:911, Error Message:"ORA-00911: invalid character"

so table doesn't drop

from go-ora.

martin-viggiano avatar martin-viggiano commented on August 27, 2024

Yes, I forked the xorm library and made the following changes:

diff --git a/dialects/oracle.go b/dialects/oracle.go
index 72c26ce..b0c5c38 100644
--- a/dialects/oracle.go
+++ b/dialects/oracle.go
@@ -609,7 +609,7 @@ func (db *oracle) IsReserved(name string) bool {
 }
 
 func (db *oracle) DropTableSQL(tableName string) (string, bool) {
-	return fmt.Sprintf("DROP TABLE `%s`", tableName), false
+	return fmt.Sprintf("DROP TABLE \"%s\"", tableName), false
 }
 
 func (db *oracle) CreateTableSQL(ctx context.Context, queryer core.Queryer, table *schemas.Table, tableName string) (string, bool, error) {
@@ -645,6 +645,10 @@ func (db *oracle) CreateTableSQL(ctx context.Context, queryer core.Queryer, tabl
 	return sql, false, nil
 }
 
+func (db *oracle) IsSequenceExist(ctx context.Context, queryer core.Queryer, seqName string) (bool, error) {
+	return db.HasRecords(queryer, ctx, `SELECT sequence_name FROM user_sequences WHERE sequence_name = :1`, seqName)
+}
+
 func (db *oracle) SetQuotePolicy(quotePolicy QuotePolicy) {
 	switch quotePolicy {
 	case QuotePolicyNone:

from go-ora.

sijms avatar sijms commented on August 27, 2024

fixed in v2.7.6

from go-ora.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.