@@ -365,6 +365,9 @@ def visit_delete(self, delete_stmt, **kw):
365365 text = super ().visit_delete (delete_stmt , ** kw )
366366 return text
367367
368+ def for_update_clause (self , select , ** kw ):
369+ return ""
370+
368371 def visit_true (self , expr , ** kw ):
369372 return "1"
370373
@@ -425,7 +428,7 @@ def _add_exact(column):
425428
426429 _order_by_clauses = [
427430 sql_util .unwrap_label_reference (elem )
428- for elem in select ._order_by_clause .clauses
431+ for elem in select ._order_by_clause .clauses if isinstance ( elem , schema . Column )
429432 ]
430433 if _order_by_clauses :
431434 select ._raw_columns = [
@@ -508,6 +511,19 @@ def visit_column(self, column, within_columns_clause=False, **kwargs):
508511 text = 'CONVERT(VARCHAR, %s)' % (text , )
509512 return text
510513
514+ def visit_concat_op_binary (self , binary , operator , ** kw ):
515+ return "STRING(%s, %s)" % (
516+ self .process (binary .left , ** kw ),
517+ self .process (binary .right , ** kw ),
518+ )
519+
520+ def visit_mod_binary (self , binary , operator , ** kw ):
521+ return (
522+ self .process (binary .left , ** kw )
523+ + " # "
524+ + self .process (binary .right , ** kw )
525+ )
526+
511527
512528class IRISDDLCompiler (sql .compiler .DDLCompiler ):
513529 """IRIS syntactic idiosyncrasies"""
@@ -519,8 +535,12 @@ def visit_drop_schema(self, drop, **kw):
519535 return ""
520536
521537 def visit_check_constraint (self , constraint , ** kw ):
522- raise exc .CompileError ("Check CONSTRAINT not supported" )
523- # pass
538+ pass
539+
540+ def visit_add_constraint (self , create , ** kw ):
541+ if isinstance (create .element , schema .CheckConstraint ):
542+ raise exc .CompileError ("Can't add CHECK constraint" )
543+ return super ().visit_add_constraint (create , ** kw )
524544
525545 def visit_computed_column (self , generated , ** kwargs ):
526546 text = self .sql_compiler .process (
@@ -706,6 +726,9 @@ def __init__(self, **kwargs):
706726 ]
707727 )
708728
729+ def _get_default_schema_name (self , connection ):
730+ return IRISDialect .default_schema_name
731+
709732 def _get_option (self , connection , option ):
710733 cursor = connection .cursor ()
711734 # cursor = connection.cursor()
@@ -751,6 +774,27 @@ def dbapi(cls):
751774 # dbapi.paramstyle = "format"
752775 return dbapi
753776
777+ def is_disconnect (self , e , connection , cursor ):
778+ if isinstance (e , self .dbapi .InterfaceError ):
779+ return "Connection is closed" in str (e )
780+ return False
781+
782+ def do_ping (self , dbapi_connection ):
783+ cursor = None
784+ try :
785+ cursor = dbapi_connection .cursor ()
786+ try :
787+ cursor .execute (self ._dialect_specific_select_one )
788+ finally :
789+ cursor .close ()
790+ except self .dbapi .Error as err :
791+ if self .is_disconnect (err , dbapi_connection , cursor ):
792+ return False
793+ else :
794+ raise
795+ else :
796+ return True
797+
754798 def create_connect_args (self , url ):
755799 opts = {}
756800 opts ["hostname" ] = url .host
0 commit comments