True if this script has already been applied to the db. False
 otherwise.
187156
def has_run?(filename)
      if @db.schema_schema_evolution_manager_exists?
        query = "select count(*) from %s.%s where filename = '%s'" % [Db.schema_name, @table_name, filename]
        @db.psql_command(query).to_i > 0
      else
        false
      end
    end
161892
def create_db(name, **client_args):
    '''
    
    '''
    if db_exists(name, **client_args):
        log.info('DB \'%s\' already exists', name)
        return False

    client = _client(**client_args)
    client.create_database(name)

    return True
964824
def db_remove(name, **connection_args):
    '''
    
    '''
    # check if db exists
    if not db_exists(name, **connection_args):
        log.info('DB \'%s\' does not exist', name)
        return False

    if name in ('mysql', 'information_scheme'):
        log.info('DB \'%s\' may not be removed', name)
        return False

    # db does exists, proceed
    dbc = _connect(**connection_args)
    if dbc is None:
        return False
    cur = dbc.cursor()
    s_name = quote_identifier(name)
    # identifiers cannot be used as values
    qry = 'DROP DATABASE {0};'.format(s_name)
    try:
        _execute(cur, qry)
    except MySQLdb.OperationalError as exc:
        err = 'MySQL Error {0}: {1}'.format(*exc.args)
        __context__['mysql.error'] = err
        log.error(err)
        return False

    if not db_exists(name, **connection_args):
        log.info('Database \'%s\' has been removed', name)
        return True

    log.info('Database \'%s\' has not been removed', name)
    return False
581221
@Override
    public boolean getIsReplicated() {
        for (StmtTableScan tableScan : m_subqueryStmt.allScans()) {
            if ( ! tableScan.getIsReplicated()) {
                return false;
            }
        }
        return true;
    }
644205
public function save() :bool {
		
		// if an id already exists
		if($this->_['id']) {
			// we can update and return the number of affected rows (0 on error, 1 on success)
			return (bool) self::_update()
				->set($this->__toArray(true, true))
				->where(['id'=>$this->_['id']])
				->execute();
		}
		// this is a new record
		else {
			// try to insert it
			$inserted_object = self::create($this->__toArray(true, true));
			// if insertion succeeded, return true
			if($inserted_object) {
				// clone ourselves with what the database returneds, a full fledged object
				$this->replicate($inserted_object);
				// return success
				return true;
			}
			// didnt insert
			else {
				// failure feedback
				return false;
			}
		}
		
	}
892088
def is_old(self):
        
        if not self.processing_started_ts:
            return True

        if self.processing_ended_ts:
            return self.processing_ended_ts + DB_CACHE_TIME < time.time()

        # in case that processing started, but didn't ended in
        # DB_MAX_WAIT_TIME
        expected_end_ts = self.creation_ts + DB_MAX_WAIT_TIME
        if expected_end_ts < time.time():
            logger.error("Prosessing timeouted and properites were not set!")

        return expected_end_ts < time.time()
1275325
def drop_db(name, **client_args):
    '''
    
    '''
    if not db_exists(name, **client_args):
        log.info('DB \'%s\' does not exist', name)
        return False

    client = _client(**client_args)
    client.drop_database(name)

    return True
363881
public boolean doHasPrevious()
    {
        if ((m_iRecordStatus & DBConstants.RECORD_AT_BOF) != 0)
            return false; // Already at BOF (can't be one before)
        if ((m_iRecordStatus & DBConstants.RECORD_PREVIOUS_PENDING) != 0)
            return true;    // Already one waiting
        boolean bAtBOF = true;
        try   {
            FieldList record = this.move(DBConstants.PREVIOUS_RECORD);
            if (record == null)
                bAtBOF = true;
            else if ((m_iRecordStatus & DBConstants.RECORD_AT_BOF) != 0)
                bAtBOF = true;
            else if (this.isTable())
                bAtBOF = this.isBOF();
            else
                bAtBOF = false;     // Valid record!
        } catch (DBException ex)    {
            ex.printStackTrace();
        }
        if (bAtBOF)
            return false; // Does not have a next record
        m_iRecordStatus |= DBConstants.RECORD_PREVIOUS_PENDING;     // If next call is a moveNext(), return unchanged!
        return true;        // Yes, a next record exists.
    }
530490
public function alreadyInstalled()
    {
        if (file_exists($this->getEnvPath())) {
            return true;
        }
        if (!file_exists($this->getConfigPath())) {
            return false;
        }
        $configContents = file_get_contents($this->getConfigPath());
        if (strstr($configContents, '$databaseConfig')) {
            return true;
        }
        if (strstr($configContents, '$database')) {
            return true;
        }
        return false;
    }
1162052
protected function checkTableExists()
  {
    $m = $this->getManager();

    $q = 'SHOW TABLES LIKE "' . $m->getPrefix() . $this->getTable() . '"';

    return (bool)$m->query($q)->rowCount();
  }
813943
def db_exists(name, **connection_args):
    '''
    
    '''
    dbc = _connect(**connection_args)
    if dbc is None:
        return False
    cur = dbc.cursor()
    # Warn: here db identifier is not backtyped but should be
    #  escaped as a string value. Note also that LIKE special characters
    # '_' and '%' should also be escaped.
    args = {"dbname": name}
    qry = "SHOW DATABASES LIKE %(dbname)s;"
    try:
        _execute(cur, qry, args)
    except MySQLdb.OperationalError as exc:
        err = 'MySQL Error {0}: {1}'.format(*exc.args)
        __context__['mysql.error'] = err
        log.error(err)
        return False
    cur.fetchall()
    return cur.rowcount == 1
698153
public function whichDB($db_name)
    {
        if ($this->connection->tableExists($db_name . $this->connection->sep() . $this->name)) {
            $this->fq_name = $db_name . $this->connection->sep() . $this->name;
            return true;
        } else {
            return false;
        }
    }
55757
def is_active(self):
    
    if self._db_connection_provider:
      # The plugin is active if one relevant tag can be found in the database.
      db = self._db_connection_provider()
      cursor = db.execute(
          '''
          SELECT 1
          FROM Tags
          WHERE Tags.plugin_name = ?
          LIMIT 1
          ''',
          (metadata.PLUGIN_NAME,))
      return bool(list(cursor))

    if not self._multiplexer:
      return False

    all_runs = self._multiplexer.PluginRunToTagToContent(metadata.PLUGIN_NAME)

    # The plugin is active if any of the runs has a tag relevant to the plugin.
    return any(six.itervalues(all_runs))
218448
function isUsed (name) {
        if (module.isUsed(name)) {
          return true
        }
        if (dupes.length > 0) {
          return dupes.some((dupe) => {
            const m = analyzer.modules.get(dupe.file)
            return m && m.isUsed(name)
          })
        }
        return false
      }
472793
def scripts_previously_run(scripts)
      if scripts.empty? || !@db.schema_schema_evolution_manager_exists?
        []
      else
        sql = "select filename from %s.%s where filename in (%s)" % [Db.schema_name, @table_name, "'" + scripts.join("', '") + "'"]
        @db.psql_command(sql).strip.split
      end
    end
4393
def apply!(dir)
      Preconditions.check_state(File.directory?(dir),
                                "Dir[%s] does not exist" % dir)

      count = 0
      @scripts.each_pending(dir) do |filename, path|
        count += 1
        if @dry_run
          puts "[DRY RUN] Applying #{filename}"
          puts path
          puts ""
        else
          print "Applying #{filename}"
          @db.psql_file(filename, path)
          @scripts.record_as_run!(filename)
          puts " Done"
        end
      end
      count
    end
214410
function() {
			if (Loader.loading) { return false; }

			var count	= 0;

			if (some(this.pending, function(script) {
				count++;
				if (script.satisfied()) {
					Loader.loading = script;
					script.module.install();
					script.load();
					return true;
				}
				return false;
			}) || count === 0) { return true; }
			return false;
		}