insert_file(file)

        Load resources entries from FILE, and insert them into the
        database.  FILE can be a filename (a string)or a file object.
164665
def insert_file(self, file):
        

        if type(file) is bytes:
            file = open(file, 'r')

        self.insert_string(file.read())
1039104
def add_file(self, filename):
        
        with (open(filename, 'rb')) as f:
            data = f.read()
        # below won't handle the same name files
        # in different paths
        fname = os.path.basename(filename)
        self.files[fname] = base64.b64encode(data)
361442
def AddToFileNameTable(self, fileName, showID):
    
    goodlogging.Log.Info("DB", "Adding filename string match '{0}'={1} to database".format(fileName, showID), verbosity=self.logVerbosity)

    currentValues = self.SearchFileNameTable(fileName)

    if currentValues is None:
      self._ActionDatabase("INSERT INTO FileName (FileName, ShowID) VALUES (?,?)", (fileName, showID))
    else:
      goodlogging.Log.Fatal("DB", "An entry for '{0}' already exists in the FileName table".format(fileName))
564236
def insert(exif, image, new_file=None):
    
    if exif[0:6] != b"\x45\x78\x69\x66\x00\x00":
        raise ValueError("Given data is not exif data")

    output_file = False
    # Prevents "UnicodeWarning: Unicode equal comparison failed" warnings on Python 2
    maybe_image = sys.version_info >= (3,0,0) or isinstance(image, str)

    if maybe_image and image[0:2] == b"\xff\xd8":
        image_data = image
        file_type = "jpeg"
    elif maybe_image and image[0:4] == b"RIFF" and image[8:12] == b"WEBP":
        image_data = image
        file_type = "webp"
    else:
        with open(image, 'rb') as f:
            image_data = f.read()
        if image_data[0:2] == b"\xff\xd8":
            file_type = "jpeg"
        elif image_data[0:4] == b"RIFF" and image_data[8:12] == b"WEBP":
            file_type = "webp"
        else:
            raise InvalidImageDataError
        output_file = True

    if file_type == "jpeg":
        exif = b"\xff\xe1" + struct.pack(">H", len(exif) + 2) + exif
        segments = split_into_segments(image_data)
        new_data = merge_segments(segments, exif)
    elif file_type == "webp":
        exif = exif[6:]
        new_data = _webp.insert(image_data, exif)

    if isinstance(new_file, io.BytesIO):
        new_file.write(new_data)
        new_file.seek(0)
    elif new_file:
        with open(new_file, "wb+") as f:
            f.write(new_data)
    elif output_file:
        with open(image, "wb+") as f:
            f.write(new_data)
    else:
        raise ValueError("Give a 3rd argument to 'insert' to output file")
366120
def Open(self):
    
    if not self._filename:
      raise ValueError('Missing filename.')

    if not self._append and os.path.isfile(self._filename):
      raise IOError((
          'Unable to use an already existing file for output '
          '[{0:s}]').format(self._filename))

    self._connection = sqlite3.connect(self._filename)
    self._cursor = self._connection.cursor()

    # Create table in database.
    if not self._append:
      self._cursor.execute(self._CREATE_TABLE_QUERY)

      for field in self._META_FIELDS:
        query = 'CREATE TABLE l2t_{0:s}s ({0:s}s TEXT, frequency INT)'.format(
            field)
        self._cursor.execute(query)
        if self._set_status:
          self._set_status('Created table: l2t_{0:s}'.format(field))

      self._cursor.execute('CREATE TABLE l2t_tags (tag TEXT)')
      if self._set_status:
        self._set_status('Created table: l2t_tags')

      query = 'CREATE TABLE l2t_saved_query (name TEXT, query TEXT)'
      self._cursor.execute(query)
      if self._set_status:
        self._set_status('Created table: l2t_saved_query')

      query = (
          'CREATE TABLE l2t_disk (disk_type INT, mount_path TEXT, '
          'dd_path TEXT, dd_offset TEXT, storage_file TEXT, export_path TEXT)')
      self._cursor.execute(query)

      query = (
          'INSERT INTO l2t_disk (disk_type, mount_path, dd_path, dd_offset, '
          'storage_file, export_path) VALUES (0, "", "", "", "", "")')
      self._cursor.execute(query)
      if self._set_status:
        self._set_status('Created table: l2t_disk')

    self._count = 0
1304214
def add_resource(self, name, file_path, ind_obj):
        """"""
        new_resource = Resource(name=name, individual=ind_obj, path=file_path)
        self.session.add(new_resource)
        self.save()
        return new_resource
635240
def populateFromFile(self, dataUrl):
        
        self._dbFilePath = dataUrl
        self._db = SqliteRnaBackend(self._dbFilePath)
        self.addRnaQuants()
1069941
def db_file(self, value):
        
        assert not os.path.isfile(value), "%s already exists" % value
        self._db_file = value
257232
def load_file(self, filename):
        """"""
        filename = os.path.abspath(filename)

        with open(filename) as f:
            self.load_dict(yaml.load(f))

        self._loaded_files.append(filename)
63442
def add_file(self, filename, block_size=4096):
        
        with open(filename, "rb") as f:
            for chunk in iter(lambda: f.read(block_size), b""):
                self.hash.update(chunk)
1314514
@Override
    public void add(File file, String baseURI, RDFFormat dataFormat, Resource... contexts) throws IOException, RDFParseException, RepositoryException {
        if(notNull(baseURI)) {
            getClient().sendAdd(file, baseURI, dataFormat, contexts);
        }else{
            getClient().sendAdd(file, file.toURI().toString(), dataFormat, contexts);
        }
    }
769390
def LoadFile(f, table_name, conn):
  """"""
  reader = csv.reader(f)
  header = next(reader)

  columns = []
  for n in header:
    n = n.replace(' ', '')
    n = n.replace('-', '_')
    columns.append(n)

  create_columns = []
  column_types = {}
  for n in columns:
    if n in column_types:
      create_columns.append("%s %s" % (n, column_types[n]))
    else:
      create_columns.append("%s INTEGER" % (n))

  c = conn.cursor()
  try:
    c.execute("CREATE TABLE %s (%s)" % (table_name, ",".join(create_columns)))
  except sqlite.OperationalError:
    # Likely table exists
    print("table %s already exists?" % (table_name))
    for create_column in create_columns:
      try:
        c.execute("ALTER TABLE %s ADD COLUMN %s" % (table_name, create_column))
      except sqlite.OperationalError:
        # Likely it already exists
        print("column %s already exists in %s?" % (create_column, table_name))

  placeholders = ",".join(["?"] * len(columns))
  insert_values = "INSERT INTO %s (%s) VALUES (%s)" % (table_name, ",".join(columns), placeholders)

  #c.execute("BEGIN TRANSACTION;")
  for row in reader:
    if row:
      if len(row) < len(columns):
        row.extend([None] * (len(columns) - len(row)))
      c.execute(insert_values, row)
  #c.execute("END TRANSACTION;")
  conn.commit()
1194234
def insert(self, context):
	
		
		
		status_code, msg = self.__endpoint.post(
			"/resources/jdbc-connection-pool",
			data={
				"id": self.__name,
				"resType": self.__res_type,
				"datasourceClassname": self.__ds_classname,
				"property": props_value(self.__props)
			}
		)
		self.__available = True
1365511
def load_file(file,append = :no_append)
      raise ArgumentError,"Invalid File" unless File.exists? file
      switch = (append == :append ? 1 : 0)
      command "loadfile #{file} #{switch}"
    end
658280
def load (self, filename):
        
        if self.filename is None:
            self.filename = filename

        stream = open(self.filename, "rb")
        for doc in yaml.load_all(stream):
            for table in doc:
                self.add(table)
        stream.close()
630583
def load_infile_sql(path, columns, options={})
      replacement = opts[:insert_ignore] ? :ignore : :replace
      options = {:update => replacement}.merge(options)
      LoadDataInfileExpression.new(path, 
                                   opts[:from].first, 
                                   columns, 
                                   options).
        to_sql(db)
    end
1201237
def add_file(self, file_to_add):
        
        from .files import File
        assert isinstance(file_to_add, File), "Files being added must be instances of a subclass of File class"
        file_to_add.node = self
        if file_to_add not in self.files:
            self.files.append(file_to_add)