Deutsch English Français Italiano |
<v0m244$164ic$2@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: DFS <nospam@dfs.com> Newsgroups: comp.os.linux.advocacy Subject: Re: Attention All Gentoo Men! Date: Sun, 28 Apr 2024 13:47:48 -0400 Organization: A noiseless patient Spider Lines: 101 Message-ID: <v0m244$164ic$2@dont-email.me> References: <17ca2468a4a06d57$249594$3268579$802601b3@news.usenetexpress.com> <662d24d5$0$2583$426a34cc@news.free.fr> <17ca362e0a552455$163588$1425202$802601b3@news.usenetexpress.com> <662d513e$0$7528$426a74cc@news.free.fr> <ey6dnbyIu7zixLP7nZ2dnZfqnPednZ2d@supernews.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sun, 28 Apr 2024 19:47:49 +0200 (CEST) Injection-Info: dont-email.me; posting-host="f6f8b8ae1735e14ee98d37a3132ab071"; logging-data="1249868"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/kGLxXfNckbKA91Eu7v0vS" User-Agent: Betterbird (Windows) Cancel-Lock: sha1:B8+FXzNwlqUisvdbHr4vyE6HiQU= Content-Language: en-US In-Reply-To: <ey6dnbyIu7zixLP7nZ2dnZfqnPednZ2d@supernews.com> Bytes: 4726 On 4/28/2024 10:13 AM, Tyrone wrote: > On Apr 27, 2024 at 3:25:50 PM EDT, "Stéphane CARPENTIER" <sc@fiat-linux.fr> > wrote: > >>> But YOU are not a programmer >> >> Neither are you. And it doesn't require a great deal of knowledge to >> know more than you about programming. > > Anyone who has written a Tic-Tac-Toe program knows more about programming than > Farley Fucktard/Diego Dipshit/whatever name he is calling himself today. > > Remember, he is the doofus who proclaims that "All programming is math" (It > will certainly look that way if the only "programming" you do is to solve > trivial math problems which BTW have already been solved), that a .csv file is > a "database" (Um, no. You import the .csv file INTO a database) Feeb often expands or contracts the meaning of a word or idea to support what he's arguing that day. On day 1 a .csv file IS a database. On day 2 a .csv file IS NOT a database. On day 1 there is no such thing as a text file. On day 2 there is such a thing as a text file. On day 1 AutoCAD is 'fantastic'. On day 2 AutoCAD is 'overblown junk'. On day 1 'software never expires'. On day 2 'whine whine whine that DFS is using Office 2003' That's how the confused fraud works. > and that one needs to "write a computer program" to determine the > field widths in a .csv file (clueless kiddie, learn some SQL). You don't need to, but you can. https://imgur.com/a/pLqp6So Writing that C program was exponentially more difficult than importing ..csv files into a dbms and using SQL. But now it runs instantaneously with almost no work on my part. Anyway, I just now figured out something cool in SQLite: Run this query (replace tblname with the actual table name) SELECT "SELECT '" || name || "' AS Column, MAX(LENGTH(" || name || ")) AS MAXLEN FROM tblname UNION ALL " FROM PRAGMA_TABLE_INFO('tblname'); It will return a row for each column in the table. Paste all the results into a SQL editor window, delete the final 'UNION ALL', terminate the SQL and run it and you get the max width of the data in each column. I did it for a table named 'XOVER'. SELECT 'SERVERID' AS Column, MAX(LENGTH(SERVERID)) AS MAXLEN FROM XOVER UNION ALL SELECT 'GROUPID' AS Column, MAX(LENGTH(GROUPID)) AS MAXLEN FROM XOVER UNION ALL SELECT 'NEWARTICLEID' AS Column, MAX(LENGTH(NEWARTICLEID)) AS MAXLEN FROM XOVER UNION ALL SELECT 'MESSAGEID' AS Column, MAX(LENGTH(MESSAGEID)) AS MAXLEN FROM XOVER UNION ALL SELECT 'XOVER' AS Column, MAX(LENGTH(XOVER)) AS MAXLEN FROM XOVER UNION ALL SELECT 'POSTER' AS Column, MAX(LENGTH(POSTER)) AS MAXLEN FROM XOVER UNION ALL SELECT 'SUBJECT' AS Column, MAX(LENGTH(SUBJECT)) AS MAXLEN FROM XOVER UNION ALL SELECT 'UTCDATETIME' AS Column, MAX(LENGTH(UTCDATETIME)) AS MAXLEN FROM XOVER; results SERVERID 1 GROUPID 2 NEWARTICLEID 7 MESSAGEID 212 XOVER 3536 POSTER 208 SUBJECT 1250 UTCDATETIME 19 sweet! That will definitely come in handy sometime. Note: 'UNION ALL' maintains the order of the columns in the schema, while 'UNION' outputs them in alpha order. This will go in my book: 'Tips, Tricks, Traps, Travails and Techniques for SQLite'. I'm sure you can do similar or better in Oracle/SQLServer/Postgres/MariaDB with SQL. https://stackoverflow.com/questions/20463365/looping-through-column-names-with-dynamic-sql