Changeset 10924


Ignore:
Timestamp:
2005-11-23T12:25:36+13:00 (18 years ago)
Author:
jrm21
Message:

updated for sql_query_prime and more hints re CSV files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/etc/packages/example.dbi

    r10866 r10924  
    3131
    3232# Data Source.
    33 # This is going to be dependent on which back-end you use.
     33# This is going to be dependent on which back-end you use. Note that these
     34# strings are case-sensitive.
    3435# Eg, for postgres, it is "DBI:Pg:dbname=<database>".
    3536# For mysql, it might look like "DBI:mysql:database=<database>;host=localhost"
     
    3738#   'DBI:CSV:f_dir=/path/to/file;csv_quote_char=\";csv_sep_char=    '
    3839# with an embedded tab character for tab-separated instead of the
    39 # default comma-separated.
    40 # Case may be important!
    41 #
    42 #$db='';
     40# default comma-separated.$db='';
    4341
    4442# If you need a username and password to connect to this database,
     
    4846#$password='';
    4947
     48# DBI does not allow you to use multiple SQL statements at once. So if
     49# you want to execute two statements (for example, to prep the data by
     50# creating a temporary table), uncomment and use this as the first statement.
     51#$sql_query_prime = 'CREATE TEMP TABLE foo AS
     52# SELECT t1.ID, t2.name
     53# FROM table1 AS t1 JOIN table2 AS t2
     54# ON t1.ID = t2.ID ';
     55
    5056# sql query required to get your rows out of the database. Each row will
    5157# become a separate greenstone document.
    5258#
    53 #$sql_query = 'SELECT id, name,  data FROM table1 JOIN table2 WHERE something';
     59#$sql_query = 'SELECT id, name, data FROM foo JOIN table2 WHERE something';
    5460# For CSV, the table name is the file name. Eg:
    5561#$sql_query = 'SELECT * FROM values.txt'
    5662# CSV may also require DOS '\r\n'-style line endings instead of unix '\n'.
     63# It is easier if your data file does not have a dot '.' in it, as that is
     64# not a valid character in an SQL table name (although it works for simple
     65# SELECTS but not joins).
    5766
    5867
Note: See TracChangeset for help on using the changeset viewer.