Mercurial > hg > xemacs-beta
comparison src/postgresql.c @ 446:1ccc32a20af4 r21-2-38
Import from CVS: tag r21-2-38
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:37:21 +0200 |
parents | abe6d1db359e |
children | 183866b06e0b |
comparison
equal
deleted
inserted
replaced
445:34f3776fcf0e | 446:1ccc32a20af4 |
---|---|
1696 } | 1696 } |
1697 | 1697 |
1698 void | 1698 void |
1699 vars_of_postgresql(void) | 1699 vars_of_postgresql(void) |
1700 { | 1700 { |
1701 char *p; | |
1702 | |
1703 Fprovide (Qpostgresql); | 1701 Fprovide (Qpostgresql); |
1704 #ifdef HAVE_POSTGRESQLV7 | 1702 #ifdef HAVE_POSTGRESQLV7 |
1705 Fprovide (intern ("postgresqlv7")); | 1703 Fprovide (intern ("postgresqlv7")); |
1706 #endif | 1704 #endif |
1707 #ifndef RUNNING_XEMACS_21_1 | 1705 #ifndef RUNNING_XEMACS_21_1 |
1709 DEFVAR_LISP ("pg-coding-system", &Vpg_coding_system /* | 1707 DEFVAR_LISP ("pg-coding-system", &Vpg_coding_system /* |
1710 Default Postgres client coding system. | 1708 Default Postgres client coding system. |
1711 */ ); | 1709 */ ); |
1712 #endif | 1710 #endif |
1713 | 1711 |
1714 if ((p = getenv ("PGHOST"))) | |
1715 { | |
1716 VXPGHOST = build_ext_string (p, PG_OS_CODING); | |
1717 } | |
1718 else | |
1719 { | |
1720 VXPGHOST = Qnil; | |
1721 } | |
1722 DEFVAR_LISP ("pg:host", &VXPGHOST /* | 1712 DEFVAR_LISP ("pg:host", &VXPGHOST /* |
1723 Default PostgreSQL server name. | 1713 Default PostgreSQL server name. |
1724 If not set, the server running on the local host is used. The | 1714 If not set, the server running on the local host is used. The |
1725 initial value is set from the PGHOST environment variable. | 1715 initial value is set from the PGHOST environment variable. |
1726 */ ); | 1716 */ ); |
1727 | 1717 |
1728 if ((p = getenv ("PGUSER"))) | |
1729 { | |
1730 VXPGUSER = build_ext_string (p, PG_OS_CODING); | |
1731 } | |
1732 else | |
1733 { | |
1734 VXPGUSER = Qnil; | |
1735 } | |
1736 DEFVAR_LISP ("pg:user", &VXPGUSER /* | 1718 DEFVAR_LISP ("pg:user", &VXPGUSER /* |
1737 Default PostgreSQL user name. | 1719 Default PostgreSQL user name. |
1738 This value is used when connecting to a database for authentication. | 1720 This value is used when connecting to a database for authentication. |
1739 The initial value is set from the PGUSER environment variable. | 1721 The initial value is set from the PGUSER environment variable. |
1740 */ ); | 1722 */ ); |
1741 | 1723 |
1742 if ((p = getenv ("PGOPTIONS"))) | |
1743 { | |
1744 VXPGOPTIONS = build_ext_string (p, PG_OS_CODING); | |
1745 } | |
1746 else | |
1747 { | |
1748 VXPGOPTIONS = Qnil; | |
1749 } | |
1750 DEFVAR_LISP ("pg:options", &VXPGOPTIONS /* | 1724 DEFVAR_LISP ("pg:options", &VXPGOPTIONS /* |
1751 Default PostgreSQL user name. | 1725 Default PostgreSQL user name. |
1752 This value is used when connecting to a database for authentication. | 1726 This value is used when connecting to a database for authentication. |
1753 The initial value is set from the PGUSER environment variable. | 1727 The initial value is set from the PGUSER environment variable. |
1754 */ ); | 1728 */ ); |
1755 | 1729 |
1756 if ((p = getenv ("PGPORT"))) | |
1757 { | |
1758 VXPGPORT = make_int (atoi (p)); | |
1759 } | |
1760 else | |
1761 { | |
1762 VXPGPORT = Qnil; | |
1763 } | |
1764 DEFVAR_LISP ("pg:port", &VXPGPORT /* | 1730 DEFVAR_LISP ("pg:port", &VXPGPORT /* |
1765 Default port to connect to PostgreSQL backend. | 1731 Default port to connect to PostgreSQL backend. |
1766 This value is used when connecting to a database. | 1732 This value is used when connecting to a database. |
1767 The initial value is set from the PGPORT environment variable. | 1733 The initial value is set from the PGPORT environment variable. |
1768 */ ); | 1734 */ ); |
1769 | 1735 |
1770 if ((p = getenv ("PGTTY"))) | |
1771 { | |
1772 VXPGTTY = build_ext_string (p, PG_OS_CODING); | |
1773 } | |
1774 else | |
1775 { | |
1776 VXPGTTY = Qnil; | |
1777 } | |
1778 DEFVAR_LISP ("pg:tty", &VXPGTTY /* | 1736 DEFVAR_LISP ("pg:tty", &VXPGTTY /* |
1779 Default debugging TTY. | 1737 Default debugging TTY. |
1780 There is no useful setting of this variable in the XEmacs Lisp API. | 1738 There is no useful setting of this variable in the XEmacs Lisp API. |
1781 The initial value is set from the PGTTY environment variable. | 1739 The initial value is set from the PGTTY environment variable. |
1782 */ ); | 1740 */ ); |
1783 | 1741 |
1784 if ((p = getenv ("PGDATABASE"))) | |
1785 { | |
1786 VXPGDATABASE = build_ext_string (p, PG_OS_CODING); | |
1787 } | |
1788 else | |
1789 { | |
1790 VXPGDATABASE = Qnil; | |
1791 } | |
1792 DEFVAR_LISP ("pg:database", &VXPGDATABASE /* | 1742 DEFVAR_LISP ("pg:database", &VXPGDATABASE /* |
1793 Default database to connect to. | 1743 Default database to connect to. |
1794 The initial value is set from the PGDATABASE environment variable. | 1744 The initial value is set from the PGDATABASE environment variable. |
1795 */ ); | 1745 */ ); |
1796 | 1746 |
1797 if ((p = getenv ("PGREALM"))) | |
1798 { | |
1799 VXPGREALM = build_ext_string (p, PG_OS_CODING); | |
1800 } | |
1801 else | |
1802 { | |
1803 VXPGREALM = Qnil; | |
1804 } | |
1805 DEFVAR_LISP ("pg:realm", &VXPGREALM /* | 1747 DEFVAR_LISP ("pg:realm", &VXPGREALM /* |
1806 Default kerberos realm to use for authentication. | 1748 Default kerberos realm to use for authentication. |
1807 The initial value is set from the PGREALM environment variable. | 1749 The initial value is set from the PGREALM environment variable. |
1808 */ ); | 1750 */ ); |
1809 | 1751 |
1810 #ifdef MULE | 1752 #ifdef MULE |
1811 /* It's not clear whether this is any use. My intent is to | 1753 /* It's not clear whether this is any use. My intent is to |
1812 autodetect the coding system from the database. */ | 1754 autodetect the coding system from the database. */ |
1813 if ((p = getenv ("PGCLIENTENCODING"))) | |
1814 { | |
1815 VXPGCLIENTENCODING = build_ext_string (p, PG_OS_CODING); | |
1816 } | |
1817 else | |
1818 { | |
1819 VXPGCLIENTENCODING = Qnil; | |
1820 } | |
1821 DEFVAR_LISP ("pg:client-encoding", &VXPGCLIENTENCODING /* | 1755 DEFVAR_LISP ("pg:client-encoding", &VXPGCLIENTENCODING /* |
1822 Default client encoding to use. | 1756 Default client encoding to use. |
1823 The initial value is set from the PGCLIENTENCODING environment variable. | 1757 The initial value is set from the PGCLIENTENCODING environment variable. |
1824 */ ); | 1758 */ ); |
1825 #endif | 1759 #endif |
1826 | 1760 |
1827 #if !defined(HAVE_POSTGRESQLV7) | 1761 #if !defined(HAVE_POSTGRESQLV7) |
1828 if ((p = getenv ("PGAUTHTYPE"))) | |
1829 { | |
1830 VXPGAUTHTYPE = build_ext_string (p, PG_OS_CODING); | |
1831 } | |
1832 else | |
1833 { | |
1834 VXPGAUTHTYPE = Qnil; | |
1835 } | |
1836 DEFVAR_LISP ("pg:authtype", &VXPGAUTHTYPE /* | 1762 DEFVAR_LISP ("pg:authtype", &VXPGAUTHTYPE /* |
1837 Default authentication to use. | 1763 Default authentication to use. |
1838 The initial value is set from the PGAUTHTYPE environment variable. | 1764 The initial value is set from the PGAUTHTYPE environment variable. |
1839 | 1765 |
1840 WARNING: This variable has gone away in versions of PostgreSQL newer | 1766 WARNING: This variable has gone away in versions of PostgreSQL newer |
1841 than 6.5. | 1767 than 6.5. |
1842 */ ); | 1768 */ ); |
1843 #endif | 1769 #endif |
1844 | 1770 |
1845 if ((p = getenv ("PGGEQO"))) | |
1846 { | |
1847 VXPGGEQO = build_ext_string (p, PG_OS_CODING); | |
1848 } | |
1849 else | |
1850 { | |
1851 VXPGGEQO = Qnil; | |
1852 } | |
1853 DEFVAR_LISP ("pg:geqo", &VXPGGEQO /* | 1771 DEFVAR_LISP ("pg:geqo", &VXPGGEQO /* |
1854 Genetic Query Optimizer options. | 1772 Genetic Query Optimizer options. |
1855 The initial value is set from the PGGEQO environment variable. | 1773 The initial value is set from the PGGEQO environment variable. |
1856 */ ); | 1774 */ ); |
1857 | 1775 |
1858 if ((p = getenv ("PGCOSTINDEX"))) | |
1859 { | |
1860 VXPGCOSTINDEX = build_ext_string (p, PG_OS_CODING); | |
1861 } | |
1862 else | |
1863 { | |
1864 VXPGCOSTINDEX = Qnil; | |
1865 } | |
1866 DEFVAR_LISP ("pg:cost-index", &VXPGCOSTINDEX /* | 1776 DEFVAR_LISP ("pg:cost-index", &VXPGCOSTINDEX /* |
1867 Default cost index options. | 1777 Default cost index options. |
1868 The initial value is set from the PGCOSTINDEX environment variable. | 1778 The initial value is set from the PGCOSTINDEX environment variable. |
1869 */ ); | 1779 */ ); |
1870 | 1780 |
1871 if ((p = getenv ("PGCOSTHEAP"))) | |
1872 { | |
1873 VXPGCOSTHEAP = build_ext_string (p, PG_OS_CODING); | |
1874 } | |
1875 else | |
1876 { | |
1877 VXPGCOSTHEAP = Qnil; | |
1878 } | |
1879 DEFVAR_LISP ("pg:cost-heap", &VXPGCOSTHEAP /* | 1781 DEFVAR_LISP ("pg:cost-heap", &VXPGCOSTHEAP /* |
1880 Default cost heap options. | 1782 Default cost heap options. |
1881 The initial value is set from the PGCOSTHEAP environment variable. | 1783 The initial value is set from the PGCOSTHEAP environment variable. |
1882 */ ); | 1784 */ ); |
1883 | 1785 |
1884 if ((p = getenv ("PGTZ"))) | |
1885 { | |
1886 VXPGTZ = build_ext_string (p, PG_OS_CODING); | |
1887 } | |
1888 else | |
1889 { | |
1890 VXPGTZ = Qnil; | |
1891 } | |
1892 DEFVAR_LISP ("pg:tz", &VXPGTZ /* | 1786 DEFVAR_LISP ("pg:tz", &VXPGTZ /* |
1893 Default timezone to use. | 1787 Default timezone to use. |
1894 The initial value is set from the PGTZ environment variable. | 1788 The initial value is set from the PGTZ environment variable. |
1895 */ ); | 1789 */ ); |
1896 | 1790 |
1897 if ((p = getenv ("PGDATESTYLE"))) | |
1898 { | |
1899 VXPGDATESTYLE = build_ext_string (p, PG_OS_CODING); | |
1900 } | |
1901 else | |
1902 { | |
1903 VXPGDATESTYLE = Qnil; | |
1904 } | |
1905 DEFVAR_LISP ("pg:date-style", &VXPGDATESTYLE /* | 1791 DEFVAR_LISP ("pg:date-style", &VXPGDATESTYLE /* |
1906 Default date style to use. | 1792 Default date style to use. |
1907 The initial value is set from the PGDATESTYLE environment variable. | 1793 The initial value is set from the PGDATESTYLE environment variable. |
1908 */ ); | 1794 */ ); |
1909 } | 1795 } |
1796 | |
1797 /* These initializations should not be done at dump-time. */ | |
1798 void | |
1799 init_postgresql_from_environment(void) | |
1800 { | |
1801 char *p; | |
1802 | |
1803 if ((p = getenv ("PGHOST"))) | |
1804 { | |
1805 VXPGHOST = build_ext_string (p, PG_OS_CODING); | |
1806 } | |
1807 else | |
1808 { | |
1809 VXPGHOST = Qnil; | |
1810 } | |
1811 | |
1812 if ((p = getenv ("PGUSER"))) | |
1813 { | |
1814 VXPGUSER = build_ext_string (p, PG_OS_CODING); | |
1815 } | |
1816 else | |
1817 { | |
1818 VXPGUSER = Qnil; | |
1819 } | |
1820 | |
1821 if ((p = getenv ("PGOPTIONS"))) | |
1822 { | |
1823 VXPGOPTIONS = build_ext_string (p, PG_OS_CODING); | |
1824 } | |
1825 else | |
1826 { | |
1827 VXPGOPTIONS = Qnil; | |
1828 } | |
1829 | |
1830 if ((p = getenv ("PGPORT"))) | |
1831 { | |
1832 VXPGPORT = make_int (atoi (p)); | |
1833 } | |
1834 else | |
1835 { | |
1836 VXPGPORT = Qnil; | |
1837 } | |
1838 | |
1839 if ((p = getenv ("PGTTY"))) | |
1840 { | |
1841 VXPGTTY = build_ext_string (p, PG_OS_CODING); | |
1842 } | |
1843 else | |
1844 { | |
1845 VXPGTTY = Qnil; | |
1846 } | |
1847 | |
1848 if ((p = getenv ("PGDATABASE"))) | |
1849 { | |
1850 VXPGDATABASE = build_ext_string (p, PG_OS_CODING); | |
1851 } | |
1852 else | |
1853 { | |
1854 VXPGDATABASE = Qnil; | |
1855 } | |
1856 | |
1857 if ((p = getenv ("PGREALM"))) | |
1858 { | |
1859 VXPGREALM = build_ext_string (p, PG_OS_CODING); | |
1860 } | |
1861 else | |
1862 { | |
1863 VXPGREALM = Qnil; | |
1864 } | |
1865 | |
1866 #ifdef MULE | |
1867 /* It's not clear whether this is any use. My intent is to | |
1868 autodetect the coding system from the database. */ | |
1869 if ((p = getenv ("PGCLIENTENCODING"))) | |
1870 { | |
1871 VXPGCLIENTENCODING = build_ext_string (p, PG_OS_CODING); | |
1872 } | |
1873 else | |
1874 { | |
1875 VXPGCLIENTENCODING = Qnil; | |
1876 } | |
1877 #endif | |
1878 | |
1879 #if !defined(HAVE_POSTGRESQLV7) | |
1880 if ((p = getenv ("PGAUTHTYPE"))) | |
1881 { | |
1882 VXPGAUTHTYPE = build_ext_string (p, PG_OS_CODING); | |
1883 } | |
1884 else | |
1885 { | |
1886 VXPGAUTHTYPE = Qnil; | |
1887 } | |
1888 #endif | |
1889 | |
1890 if ((p = getenv ("PGGEQO"))) | |
1891 { | |
1892 VXPGGEQO = build_ext_string (p, PG_OS_CODING); | |
1893 } | |
1894 else | |
1895 { | |
1896 VXPGGEQO = Qnil; | |
1897 } | |
1898 | |
1899 if ((p = getenv ("PGCOSTINDEX"))) | |
1900 { | |
1901 VXPGCOSTINDEX = build_ext_string (p, PG_OS_CODING); | |
1902 } | |
1903 else | |
1904 { | |
1905 VXPGCOSTINDEX = Qnil; | |
1906 } | |
1907 | |
1908 if ((p = getenv ("PGCOSTHEAP"))) | |
1909 { | |
1910 VXPGCOSTHEAP = build_ext_string (p, PG_OS_CODING); | |
1911 } | |
1912 else | |
1913 { | |
1914 VXPGCOSTHEAP = Qnil; | |
1915 } | |
1916 | |
1917 if ((p = getenv ("PGTZ"))) | |
1918 { | |
1919 VXPGTZ = build_ext_string (p, PG_OS_CODING); | |
1920 } | |
1921 else | |
1922 { | |
1923 VXPGTZ = Qnil; | |
1924 } | |
1925 | |
1926 if ((p = getenv ("PGDATESTYLE"))) | |
1927 { | |
1928 VXPGDATESTYLE = build_ext_string (p, PG_OS_CODING); | |
1929 } | |
1930 else | |
1931 { | |
1932 VXPGDATESTYLE = Qnil; | |
1933 } | |
1934 } | |
1935 |