execute raw sql
@class Model
@method raw
@param {string} sql - The raw sql query.
@param {array} attrs - Query attributes.
@param {function} callback - The callback.

@see Model.exec

@return {Model}
480337
function(sql, attrs, callback) {
    var promise = this.definition.store.connection.raw(sql, attrs)

    if (typeof callback === 'function') {
      promise.then(callback)
    }

    return promise
  }
1330180
public Cursor rawQuery(String sql, String[] makeArgListQueryString) throws SQLException {
    Log.v("SQLiteDatabase rawQuery: " + Thread.currentThread().getId() + " \"" + Thread.currentThread().getName() + "\" " + sql);
    long timeNow = System.currentTimeMillis();
    long delta = 0;
    do {
      try {
        Cursor cursor = sqliteDatabase.rawQuery(sql, makeArgListQueryString);
        Log.v("SQLiteDatabase rawQuery OK: " + Thread.currentThread().getId() + " \"" + Thread.currentThread().getName() + "\" " + sql);
        return cursor;
      } catch (SQLiteException e) {
        if ( isLockedException(e) ) {
          delta = System.currentTimeMillis() - timeNow;
        } else {
          throw SQLDroidConnection.chainException(e);
        }
      }
    } while (delta < timeout);
    throw new SQLException ("Timeout Expired");
  }
446533
def execute_sql(
    host,
    username,
    password,
    sql,
    schema=None,
    param=None,
    kwargs=None
):
    """"""
    kwargs.schema = coalesce(kwargs.schema, kwargs.database)

    if param:
        with MySQL(kwargs) as temp:
            sql = expand_template(sql, quote_param(param))

    # We have no way to execute an entire SQL file in bulk, so we
    # have to shell out to the commandline client.
    args = [
        "mysql",
        "-h{0}".format(host),
        "-u{0}".format(username),
        "-p{0}".format(password)
    ]
    if schema:
        args.append("{0}".format(schema))

    try:
        proc = subprocess.Popen(
            args,
            stdin=subprocess.PIPE,
            stdout=subprocess.PIPE,
            stderr=subprocess.STDOUT,
            bufsize=-1
        )
        if is_text(sql):
            sql = sql.encode("utf8")
        (output, _) = proc.communicate(sql)
    except Exception as e:
        raise Log.error("Can not call \"mysql\"", e)

    if proc.returncode:
        if len(sql) > 10000:
            sql = "<" + text_type(len(sql)) + " bytes of sql>"
        Log.error(
            "Unable to execute sql: return code {{return_code}}, {{output}}:\n {{sql}}\n",
            sql=indent(sql),
            return_code=proc.returncode,
            output=output
        )
1022107
def db_exec(self, query, args=None):
        
        if args is None:
            self.db_query(query)
        else:
            self.db_query(query, args)

        self.db.commit()
623179
function(attrs, callback) {
      var t = this;

      // Value is the only thing to set
      if (typeof attrs.value === 'undefined') {
        return callback({code:'NO_VALUE'});
      }

      // Set the model elements.  These cause change events to fire
      if (t.isModel) {
        t.value.set(attrs.value);
      }
      else {
        // Set the variable directly
        var jsonValue = JSON.stringify(attrs.value);
        t._evaluate(t.key + ' = ' + jsonValue);
        t.set('value', attrs.value);
      }
      return callback();
    }
370783
def rawsql(query, ec=None):
    
    if isinstance(query, Result):
        query = query.get_query()

    ec = ec or __default_engine__
    if isinstance(ec, (str, unicode)):
        engine = engine_manager[ec]
        dialect = engine.engine.dialect
    else:
        dialect = ec.dialect
    if isinstance(query, (str, unicode)):
        return query
    # comp = query.compile(dialect=dialect)

    compiler = query._compiler(dialect)
    class LiteralCompiler(compiler.__class__):
        def visit_bindparam(
                self, bindparam, within_columns_clause=False,
                literal_binds=False, **kwargs
        ):
            return super(LiteralCompiler, self).render_literal_bindparam(
                    bindparam, within_columns_clause=within_columns_clause,
                    literal_binds=literal_binds, **kwargs
            )
        def render_literal_value(self, value, type_):
            """Render the value of a bind parameter as a quoted literal.

            This is used for statement sections that do not accept bind paramters
            on the target driver/database.

            This should be implemented by subclasses using the quoting services
            of the DBAPI.

            """
            return repr_value(value)

    compiler = LiteralCompiler(dialect, query)
    return str(compiler.process(query)).replace('\n', '')
946613
def _execute_sql_query(
            self):
        
        self.log.info('starting the ``_execute_sql_query`` method')

        # generate the api call url
        params = urllib.urlencode({'cmd': self.sqlQuery, 'format': "json"})
        # grab the results
        results = urllib.urlopen(self.sdssUrl + '?%s' % params)

        # report any errors
        ofp = sys.stdout
        results = results.read()
        if results.startswith("ERROR"):  # SQL Statement Error -> stderr
            ofp = sys.stderr
            ofp.write(string.rstrip(line) + os.linesep)

        # clean up the json response so it can be parsed
        results = results.replace(
            ": ,", ': "NULL",')
        regex = re.compile(r'"photoz_err"\:\s*(\n\s*})')
        newString = regex.sub('"photoz_err": "NULL"\g<1>', results)
        results = newString

        # parse the json results
        results = json.loads(results)[0]
        self.results = results["Rows"]

        self.log.info('completed the ``_execute_sql_query`` method')
        return
1345413
def db_exec(self, sql: str, *args) -> int:
        """"""
        self.ensure_db_open()
        cursor = self.db.cursor()
        return self.db_exec_with_cursor(cursor, sql, *args)
1120580
private SFBaseResultSet executeQuery(
      String sql,
      Map<String, ParameterBindingDTO> parametersBinding,
      boolean describeOnly,
      CallingMethod caller)
  throws SQLException, SFException
  {
    sanityCheckQuery(sql);

    String trimmedSql = sql.trim();

    // snowflake specific client side commands
    if (isFileTransfer(trimmedSql))
    {
      // PUT/GET command
      logger.debug("Executing file transfer locally: {}", sql);

      return executeFileTransfer(sql);
    }

    // NOTE: It is intentional two describeOnly parameters are specified.
    return executeQueryInternal(
        sql,
        parametersBinding,
        describeOnly,
        describeOnly, // internal query if describeOnly is true
        caller
    );
  }
1200437
final DataSet executeQuery(CallInfo callInfo, boolean takeSnapshot) {
    DataSet data = new DataSet(this);
    return db.access(callInfo, () -> {
      try (WrappedStatement ws = db.compile(getSQLForQuery())) {
        proceedWithQuery(ws.getStatement(), data);
        if (takeSnapshot) {
          setSnapshot(data);
          db.logSnapshot(callInfo, data);
        } else {
          db.logQuery(callInfo, data);
        }
      }
      return data;
    });
  }
534723
public int execute(String sql, Object... params) throws SQLException {
		Connection conn = null;
		try {
			conn = this.getConnection();
			return SqlExecutor.execute(conn, sql, params);
		} catch (SQLException e) {
			throw e;
		} finally {
			this.closeConnection(conn);
		}
	}
109860
Object execute(Config config, ICallback callback) {
		Connection conn = null;
		try {
			conn = config.getConnection();
			return callback.call(conn);
		} catch (Exception e) {
			throw new ActiveRecordException(e);
		} finally {
			config.close(conn);
		}
	}
54804
def execute_sql(self, sql):
        """"""
        cursor = self.get_cursor()
        cursor.execute(sql)
        return cursor
754278
function(callback){

    output("Initializing queries...");

    if(program.keyspace){
        batchQueries.unshift("USE " + program.keyspace + ";");
    }

    if(batchQueries && batchQueries.length > 0){
        output("Running queries...");
        executeQuery(batchQueries.shift(), callback);
    }else{
        callback("No queries to run.", null);
    }
}
1281615
public static void executeSQL(final SQLiteDatabase database, Context context, int rawResourceId) {
		String[] c = IOUtils.readTextFile(context, rawResourceId).split(";");
		List<String> commands = Arrays.asList(c);
		executeSQL(database, commands);
	}
580344
function execute(sql, params) {

	if (0 === sql.trim().length) {
		console.error("\nNo SQL to process\n");
		yargs.showHelp();
		process.exit(1);
	}

	for (var i = 1; i < params.length; i++) {
		var a = params[i];
		if (a[0] !== '"' && a[0] !== "'") {
			if (+a == a) { // jshint ignore:line
				params[i] = +a;
			}
		}
	}

	alasql.promise(sql, params)
		.then(function (res) {
			if (!alasql.options.stdout) {
				console.log(formatOutput(res));
			}
			process.exit(0);
		}).catch(function (err) {
			let errorJsonObj = JSON.parse(JSON.stringify(err, Object.getOwnPropertyNames(err)));
			console.error(formatOutput({
				error: errorJsonObj
			}));
			process.exit(1);
		});
}
659996
function Execute($sql,$inputarr=false)
	{
		if ($this->fnExecute) {
			$fn = $this->fnExecute;
			$ret = $fn($this,$sql,$inputarr);
			if (isset($ret)) {
				return $ret;
			}
		}
		if ($inputarr !== false) {
			if (!is_array($inputarr)) {
				$inputarr = array($inputarr);
			}

			$element0 = reset($inputarr);
			$array2d =  $this->bulkBind && is_array($element0) && !is_object(reset($element0));

			# see http://phplens.com/lens/lensforum/msgs.php?id=18786
			if ($array2d || !$this->_bindInputArray) {

				# is_object check because oci8 descriptors can be passed in
				if ($array2d && $this->_bindInputArray) {
					if (is_string($sql)) {
						$stmt = $this->Prepare($sql);
					} else {
						$stmt = $sql;
					}

					foreach($inputarr as $arr) {
						$ret = $this->_Execute($stmt,$arr);
						if (!$ret) {
							return $ret;
						}
					}
					return $ret;
				} else {
					$sqlarr = explode(':', $sql);
					$sql = '';
					$lastnomatch = -2;
					#var_dump($sqlarr);echo "<hr>";var_dump($inputarr);echo"<hr>";
					foreach($sqlarr as $k => $str) {
						if ($k == 0) {
							$sql = $str;
							continue;
						}
						// we need $lastnomatch because of the following datetime,
						// eg. '10:10:01', which causes code to think that there is bind param :10 and :1
						$ok = preg_match('/^([0-9]*)/', $str, $arr);

						if (!$ok) {
							$sql .= $str;
						} else {
							$at = $arr[1];
							if (isset($inputarr[$at]) || is_null($inputarr[$at])) {
								if ((strlen($at) == strlen($str) && $k < sizeof($arr)-1)) {
									$sql .= ':'.$str;
									$lastnomatch = $k;
								} else if ($lastnomatch == $k-1) {
									$sql .= ':'.$str;
								} else {
									if (is_null($inputarr[$at])) {
										$sql .= 'null';
									}
									else {
										$sql .= $this->qstr($inputarr[$at]);
									}
									$sql .= substr($str, strlen($at));
								}
							} else {
								$sql .= ':'.$str;
							}
						}
					}
					$inputarr = false;
				}
			}
			$ret = $this->_Execute($sql,$inputarr);

		} else {
			$ret = $this->_Execute($sql,false);
		}

		return $ret;
	}