~ubuntu-branches/ubuntu/gutsy/psqlodbc/gutsy

« back to all changes in this revision

Viewing changes to docs/howto-accesslo.html

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2007-03-05 22:28:19 UTC
  • mfrom: (3.1.4 edgy)
  • Revision ID: james.westby@ubuntu.com-20070305222819-95d0rzmt2ah6dwwc
Tags: 1:08.01.0200-2.1
* Non-maintainer upload.
* High-urgency upload for RC bugfix.
* Fix the signature of SQLGetData on 64-bit architectures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 
2
<html>
 
3
  <head>
 
4
    <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
 
5
    <title>psqlODBC HOWTO - Access Large Objects</title>
 
6
  </HEAD>
 
7
 
 
8
  <body bgcolor="#ffffff" text="#000000" link="#ff0000" vlink="#a00000" alink="#0000ff">
 
9
  
 
10
<h1>psqlODBC HOWTO - Access Large Objects</h1>
 
11
 
 
12
<p>
 
13
 
 
14
<i>
 
15
Author: Unknown<br>
 
16
Release Date: Unknown<br>
 
17
Description: Using large objects in Microsoft Access (notes from the original psqlODBC docs)
 
18
</i>
 
19
<br><br>
 
20
 
 
21
<h2>Using Large Objects for handling LongVarBinary (OLE Objects in Access)</h2>
 
22
 
 
23
<p>Large objects are mapped to LONGVARBINARY in the driver to allow storing things like
 
24
OLE objects in Microsoft Access.  Multiple SQLPutData and SQLGetData calls are usually
 
25
used to send and retrieve these objects.  The driver creates a new large object and simply
 
26
inserts its 'identifier' into the respective table.  However, since PostgreSQL uses an 'Oid'
 
27
to identify a Large Object, it is necessary to create a new PostgreSQL type to be able
 
28
to discriminate between an ordinary Oid and a Large Object Oid.  Until this new type
 
29
becomes an official part of PostgreSQL, it must be added into the desired database and
 
30
looked up for each connection.  The type used in the driver is simply called "lo" and
 
31
here is the command used to create it:</p>
 
32
 
 
33
<blockquote>
 
34
<pre>
 
35
create type lo (
 
36
    internallength=4,
 
37
    externallength=10,
 
38
    input=int4in,
 
39
    output=int4out,
 
40
    default='',
 
41
    passedbyvalue
 
42
);
 
43
</pre>
 
44
</blockquote>
 
45
 
 
46
<p>Once this is done, simply use the new 'lo' type to define columns in that database.  Note
 
47
that this must be done for each database you want to use large objects in with the driver.
 
48
When the driver sees an 'lo' type, it will handle it as LONGVARBINARY.</p>
 
49
 
 
50
<p>Another important note is that this new type is lacking in functionality.  It will not
 
51
cleanup after itself on updates and deletes, thus leaving orphans around and using up
 
52
extra disk space.  And currently, PostgreSQL does not support the vacuuming of large
 
53
objects.  Hopefully in the future, a real large object data type will be available.</p>
 
54
 
 
55
<p>But for now, it sure is fun to stick a Word document, Visio document, or avi of a dancing
 
56
baby into a database column, even if you will fill up your server's hard disk after a while!</p>
 
57
 
 
58
</body>
 
59
</html>