Example #1
0
        public static XVar db_exec_import(XVar sql, XVar conn, XVar table, XVar isIdentityOffNeeded)
        {
            Connection connection = XVar.UnPackConnection(conn);

            try
            {
                connection.db_multipleInsertQuery(new XVar(0, sql), table, isIdentityOffNeeded);
                return(true);
            }

            catch (Exception e)
            {
                bool handle = ((connection.dbType != Constants.nDATABASE_MySQL &&
                                connection.dbType != Constants.nDATABASE_MSSQLServer &&
                                connection.dbType != Constants.nDATABASE_Access &&
                                connection.dbType != Constants.nDATABASE_PostgreSQL &&
                                connection.dbType != Constants.nDATABASE_Oracle &&
                                connection.dbType != Constants.nDATABASE_SQLite3)

                               || (connection.dbType == Constants.nDATABASE_MSSQLServer && e is System.Data.SqlClient.SqlException) ||
                               (connection.dbType == Constants.nDATABASE_Access && e is System.Data.OleDb.OleDbException)
                               );

                if (!handle)
                {
                    throw;
                }

                GlobalVars.LastDBError = e.Message;
                return(false);
            }
        }