Complex conditional insert
I have two table, accounts describing various accounts and gives the account balance and ledger, which recodrs all account transactions. Playing around with the accounting tables, I have an user transaction that goes into the ledger but the values placed in the ledger balance columns depend on whether the entry is an asset, liability, or equity. The accounts table inform me of the type of entry, and has columns (account int, type enum (liability,asset,equity) I have the account type and account number and cash value from the user form (user is making some transaction to an account, now I want to enter the transaction properly into the ledger) To make a journal entry: // First get the account type SELECT @type:= type from accounts where accounts.number=user_selected; // then the hard part INSERT into journal values case @type WHEN equity THEN (place account.number, value in second and fifth column) WHEN asset THEN (place account.number, value in fsecond and fiftth column) WHEN liability THEN (place account.number, value in third and fourth column); or is it: INSERT into journal values(account.number, // and four separate case statements for each succeeding column) or CASE @type WHEN equity THEN [do this complete INSERT statement WHEN equity THEN [do this different INSERT statement WHEN equity THEN [do this INSERT statement or none of the above Matt Young EverydaySoftware.biz -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
New combined MySql and Html development platform
This site: http://www.everydaysoftware.biz Has a complete MySql and Html development environment running on the browser site itself, with debug, edit, run capability. To gain access to the development environment, click Develop on the left from of the opening page. The environment is written in URL code, called Uscript, which allows general intermixing of sql, html, and javascript syntax in a single script. The scripts are stored in Mysql which combines the functionality of a file directory and database. The entire application at http://www.everydaysoftware.biz includes demos of paging anchors, banners, paypal, database discovery and automatic generation of database function anchors, a help system (still developing), password, login, and a development environment. All written in the same coding that is used for URLs. The Uscript engine is less than 2,000 lines of c code. To gain access to the development environment, click Develop on the left from of the opening page. Matt Young Everyday Software -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Multiple sql lines in command line tool
I am running the command line in two modes. In one I pipe to it in an application with arguments -s -n -N -r; and I can send multiple queries in one write to the mysql command line too. I then run mysql command tool in the linux shell with the same parameters and I cannot submit multiple queries on one line. I wonder what the catch is. I have gotten the embedded application running, instead of pipes. And I evidently lose the ability to submitt multiple sql statements. I wonder how I can obtain that capability back. Matt Young -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Big time newbie question on embedded linking
I have both the standard and source mysql, and I am attempting a link with a simple program that calles mysql_server_init and mysql_server_end. I have tried various library call outs to find these two calls in both the standard and source mysql directories. I have not located these in any of the .a libraries, but did find them in the mysql.o I have these files in the standard mysql lib, and put my program right in the directory, and specified every file directly, with -l, set up the -L using the reports from mysql_config (which didn't exactly call out the proper dirictories). The only time of found the routines was when linking to mysql.o directly. So something is wrong with my set up This command file: ls pwd CFLAG='-v -H' LFLAG='-L/usr/local/mysql/lib' IFLAG=-I/usr/local/mysql/include AFILES='libz.so libmygcc.a libmysqld.a libmysqlclient.a' gcc $IFLAG $AFILES $LFLAG $1 Yields this result: embedded.c libdbug.a libmysql.olibmysqlclient_r.a libmystrings.a libz.so hash.o libmygcc.a libmysqlclient.a libmysqld.a libmysys.a temp /root/downloads/mysql/lib /tmp/ccWL6K7x.o: In function `main': /tmp/ccWL6K7x.o(.text+0x20): undefined reference to `mysql_server_init' /tmp/ccWL6K7x.o(.text+0x28): undefined reference to `mysql_server_end' collect2: ld returned 1 exit status -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Detecting error when no data is served
I am running mysql through a pipe with flags -s -n -R -r which works fine except a pipe read hangs when there is no data for a query. I tried many things, nothing works. Running on Linux with version 3.23,53 Thanks Matt Young -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
More on Uscript
The Uscript concept is worth a short look. Recently I discussed a new lightweight middleware for the web called Uscript. I have the system up and running with help and information pages at http://12.234.12.151/cgi-bin my home computer. I will try to keep the system up during the day for those who want to see what Uscript is all about. To review, Uscript is a very lightweight run time macro language, about 1,500 lines of code, that is sitting between thttpd (Jef Poskanzerand) mysql. I have complete applications up and running. I have noticed that there is a less functional but similiar capability announced by IBM for DB2. Matt Young [EMAIL PROTECTED] Saratoga, CA -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Missing library named 'z' ??
The manual says: For example, if the library is installed in `/usr/local/mysql/lib', use -L/usr/local/mysql/lib -lmysqlclient -lz on the link command. But I found no z library? Matt Young -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
U Script, a lightweigt middleware for MySQL
Uscript Some months ago I developed a lightweight middle layer between MySql and the web. The purpose was experimentation with web programming without the complexity of a standard middleware layer. I will describe the system to you, and make the source available if anyone wants to experiment with the concept. The syntax is based on URL grammar. My hello program is: http://address/U?print= Hello World or if necessary http://address/U?print= Content-type: text/html\r\n\r\nHello World Either of these copied into the web address of the browser prints a screen with Hello World. The system relies on built in URL scripts, URL scripts stored in MySQL, and the original URL script arriving from the browser. Language characters: = Macro assignment Macro definition terminator $ Macro expansion _ External Macro expansion % escaping sequence Syntax: A Uscript is an arbitrary intermixing of the following: 1) plain text 2) $symbol _symbol 3) symbol= uscript The system works as a run time macro language. The language is a recursive macro define and expand. Plain text is emitted, macros defined special character define symbols which are expanded. a macro definition is: name= arbitrary text an expansion is: $name or if the macro is predefined in the MySQL data base. _name Similiar to M4, the U interpreter contains a formatter. The formatter is useful for filling in SQL and HTML templates for proper execution. Predefined macros are stored in the MySql as text in standard tables. The predefined macros are the special power of the macro language, and I have developed a collection of special- HTML and SQL templates which can be expanded as external macros. The parameters in the templates are substituted by macro expansion. Macro expansions follow expected recursive rules: $$name will expand $name then attempt to expand the result as a macro. When expansion is complete the resulting text is passed back to the browser. The macro processor has access to the web and to MySql. The input and output from the database is placed into a square buffer(s) which can be rotated, dot producted, and cross producted in various manners under a special ioctl macro that controls sql IO. Other special executive macros are built in. out , out_exec// Flush the buffer outb , outb_exec // Flush the buffer outf , outf_exec // Execute tha macro and flush form , format // Format the iop, iop_exec inner , inner_exec sqlio , sqlio_exec // Send expanded text to MySQL mode , mode_exec// Change the mode of the SQL square buffer parse , parse_exec // Execute the specified u script blob , blob_exec// Interpret a binary blob ioctl, ioctl_exec // Modify the operation of the square buffer Memory management. The system assumes text last for the life of the web page. Uscript output is kept in an output buffer until one of the output executives flush the system. Oldest symbols are garbaged when the symbol table fills. SQL input is flushes to a square buffers which are stacked. Special symbols are compiled into the U interpreter: There is no text manipulation, all symbols are managed with pointers to a text buffer. All 256 characters are valid, except U script special chars must be escaped to be treated as text. There are no NULL terminated strings, and zero is a valid text char. The Formatter: Aside from the Uscript parser, the system offers a separate formatter, similiar to the M4 formatter. This is used to fill in careful text strings needed for HTML and SQL templates. Some of the most frequent HTMS and SQL strings are stored in the parser itself at start up to speed the processing. These templates generally contain symbols that must be expanded. Example: HttpText= Content-type: text/html\r\n\r\nhtml head $css /headbody In this pre-defined template a style pointer is required for expansion. This allows compact html pages, for example: $out=css=StandardStyle $HttpText arbitary text $End would be activated with: http://address/U?$out=css=StandardStyle; $HttpText arbitary text $End Or if the desired page format is stored as the template css=StandardStyle $HttpText arbitary text $End in MySql then: http://address/U?$out=_css; works. Loading u script into sql tables The normal operation of sequences of html pages is activated by the user when an html tag issuse a valid Uscript. For example, the following template is stored in the SQL pre-defines. Its purpose is to provide the next and previous tags that appear at the bottom of a table of sql records. They can be utilized with the macro expansion _UpdateAnchor. The calling U script will predefine the appropiate symbols and the macro is emitted. For example, db defines the data base, tb the table, sql the query macro, html the output format. UpdateAnchor p a href=U?next=PageAnchorsdb=$dbtb=$tbsql=$sqlhtml=$htmllimit=$limitoffset=%0GOTO=_$PREVNext/a a
What terminates a query?
My sql command pipes its result to a perl program (in batch mode) . but the perl program has no waf to tell when the query is finished. HTTP uses a blank line to signal the end. but there is no such thing for mysql. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php