⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 example1.html

📁 Coware的LISA指令集描述语言开发包
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> lisa MANUAL: EXAMPLE 1 </TITLE>
<META NAME="Generator" CONTENT="myself">
<META NAME="Author" CONTENT="Gabriele Budelacci">
</HEAD>

<BODY STYLE="font-family:sans-serif;">

<H1><B><I>lisa</I></B> MANUAL: EXAMPLE 1</H1>
<BR>
Copyright &copy; 2002, Gabriele Budelacci
&lt;<A HREF="mailto:g.bude@eudoramail.com">g.bude@eudoramail.com</A>&gt;
<BR>
<BR>
<small>Example 1 version 1.0.0 (2002-09-06)</small>
<BR>
<HR>
<BR>

Supposing you have a MySQL database called <I>testdb</I>, containing the following table:
<CENTER>
	<BR>
	<TABLE BORDER='2' CELLSPACING='0' CELLPADDING='0' BORDERCOLOR='Gray'>
	<TR>
		<TD>
			<TABLE BORDER='0' CELLSPACING='0' CELLPADDING='2'>
			<TR>
				<TD ALIGN='Right'><B>Table name:</B></TD>
				<TD>users</TD>
			</TR>
			<TR>
				<TD ALIGN='Right'><B>Description:</B></TD>
				<TD>Contains code (unique), firstname and lastname of many users</TD>
			</TR>
			<TR>
				<TD ALIGN='Right'><B>Fields:</B></TD>
				<TD>code, firstname, lastname</TD>
			</TR>
			<TR>
				<TD ALIGN='Right'><B>Indexes:</B></TD>
				<TD>code</TD>
			</TR>
			</TABLE>
		</TD>
	</TR>
	</TABLE>
	<BR>
</CENTER>

A simple <B><I>lisa</I></B> program for accessing this table is:
<CENTER>
	<BR>
	<TABLE BORDER='2' CELLSPACING='0' CELLPADDING='2' BORDERCOLOR='Gray'>
	<TR>
		<TD>
<PRE>
<FONT COLOR="Marroon">&lt;%
<FONT COLOR="Blue">set</FONT> result;
result = <FONT COLOR="Red">dbQuery</FONT>( <FONT COLOR="Magenta">"SELECT code, firstname, lastname FROM users ORDER BY lastname, firstname;"</FONT> );
%&gt;</FONT>
<FONT COLOR="Marroon">&lt;% <FONT COLOR="Green">// process the result only if it's not empty...</FONT> %&gt;</FONT>
<FONT COLOR="Marroon">&lt;% <FONT COLOR="Blue">if</FONT> ( ! <FONT COLOR="Red">dbEmpty</FONT>( result ) ): %&gt;</FONT>
	&lt;TABLE BORDER='1'&gt;
	&lt;TR&gt;
		&lt;TD&gt; &lt;B&gt; First Name &lt;/B&gt; &lt;/TD&gt;
		&lt;TD&gt; &lt;B&gt; Last Name &lt;/B&gt; &lt;/TD&gt;
		&lt;TD&gt; &lt;B&gt; Code &lt;/B&gt; &lt;/TD&gt;
	&lt;/TR&gt;
	<FONT COLOR="Marroon">&lt;% <FONT COLOR="Green">// for every result set, write a table row...</FONT> %&gt;</FONT>
	<FONT COLOR="Marroon">&lt;% <FONT COLOR="Blue">foreach</FONT> ( result <FONT COLOR="Blue">as</FONT> code, firstname, lastname ): %&gt;</FONT>
		&lt;TR&gt;
			&lt;TD&gt; <FONT COLOR="Marroon">&lt;%= firstname %&gt;</FONT> &lt;/TD&gt;
			&lt;TD&gt; <FONT COLOR="Marroon">&lt;%= lastname %&gt;</FONT> &lt;/TD&gt;
			&lt;TD&gt; <FONT COLOR="Marroon">&lt;%= code %&gt;</FONT> &lt;/TD&gt;
		&lt;/TR&gt;
	<FONT COLOR="Marroon">&lt;% <FONT COLOR="Blue">endforeach</FONT>; %&gt;</FONT>
	&lt;/TABLE&gt;
<FONT COLOR="Marroon">&lt;% <FONT COLOR="Blue">endif</FONT>; %&gt;</FONT>
</PRE>
		</TD>
	</TR>
	</TABLE>
	<BR>
</CENTER>

The <B>config.xml</B> file shows like this:
<CENTER>
	<BR>
	<TABLE BORDER='2' CELLSPACING='0' CELLPADDING='0' BORDERCOLOR='Gray'>
	<TR>
		<TD>
<PRE>
&lt;?xml version="1.0"?&gt;
&lt;database&gt;
    &lt;db-type&gt; <B>mySQL</B> &lt;/db-type&gt;
    &lt;db-host&gt; <B>mysqlhost.foo</B> &lt;/db-host&gt;
    &lt;db-port&gt;  &lt;/db-port&gt;
    &lt;db-name&gt; <B>testdb</B> &lt;/db-name&gt;
    &lt;db-dsn&gt;  &lt;/db-dsn&gt;
    &lt;jdbc&gt;
        &lt;jdbc-driver&gt;  &lt;/jdbc-driver&gt;
        &lt;jdbc-string&gt;  &lt;/jdbc-string&gt;
    &lt;/jdbc&gt;
    &lt;db-username&gt;  &lt;/db-username&gt;
    &lt;db-password&gt;  &lt;/db-password&gt;
&lt;/database&gt;
</PRE>
		</TD>
	</TR>
	</TABLE>
	<BR>
</CENTER>

The <B>config.xml</B> file must be placed in the same directory containing the source code of this example.<BR>
Once you're entered this directory, you can compile the example by typing:
<blockquote style="background-color:#CDCDCD;">
	<B>lisac</B> --php <I>example1.lisa</I><BR>
</blockquote>
This will compile the <B>example1.lisa</B> source file to the <B>example1.php</B> file.<BR>
The <B>dbsupport.php</B> file will be created using the infos specifieds in the <B>config.xml</B> file.<BR>
<BR>
Once you have installed <B><I>lisa</I></B> distribution, you may have entered the <B>modules</B> directory
and compiled the <B>std.lisa</B> source, generating the <B>std</B> module:
<blockquote style="background-color:#CDCDCD;">
	<B>lisac</B> --module --php <I>std.lisa</I><BR>
</blockquote>
Last, you must copy all the <B>.php</B> generated files into a public web directory and test the page.<BR>
<BR>
The page may show like this:<BR>
<BR>
<CENTER><IMG SRC="example1/example1.gif" BORDER=0 ALT="example 1 page"></CENTER>
<BR>

<HR>

<H2>LEGAL</H2>

Copyright &copy; 2002 Gabriele Budelacci &lt;<A HREF="mailto:g.bude@eudoramail.com">g.bude@eudoramail.com</A>&gt;<BR>
<BR>
This example/tutorial is free documentation; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free software Foundation; either version 2 of the license, or (at your option) any later version.<BR>
<BR>
This software is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the GNU General Public License for more details. You can obtain a copy of the GNU General Public License by writing to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.<BR>
<BR>
If you use this software in a commercial distribution, it would be nice to send the authors a complimentary copy of your product.<BR>
<BR>


</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -