Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.advocacy > #348096
| From | DFS <nospam@dfs.com> |
|---|---|
| Newsgroups | comp.os.linux.advocacy |
| Subject | Re: Can anyone here defend LibreOffice crapware against the masterful MS Office? |
| Date | 2016-03-29 19:22 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <ndf2hj$e4b$2@dont-email.me> (permalink) |
| References | (5 earlier) <nd9o8v$t6i$1@dont-email.me> <hjgid02.aa4@rooftop.invalid> <ghjdi903t.at4og@rooftop.invalid> <ndeo22$54a$1@dont-email.me> <fhju00a3f.ag@rooftop.invalid> |
On 03/29/2016 04:43 PM, owl wrote:
> DFS <nospam@dfs.com> wrote:
>> On 03/29/2016 03:44 PM, owl wrote:
>>> owl <owl@rooftop.invalid> wrote:
>>>> DFS <nospam@dfs.com> wrote:
>>>
>>>>>
>>>>> 2,099,101 rows
>>>>> 114 tables
>>>>> 971 columns
>>>>> text: 503
>>>>> boolean: 4
>>>>> numeric: 351
>>>>> date-time: 108
>>>>> binary: 5
>>>>> 309 indexes (25 foreign keys)
>>>>> 333,533,184 bytes on disk
>>>>
>>>> Didn't think there was that much porn in the universe.
>>>>
>>>>> Time: 0.17 seconds
>>>>>
>>>>
>>>> I'll fiddle with larger number of columns, more rows, etc. and try
>>>> to build a comparable test database.
>>>>
>>>
>>> And...
>>>
>>> anon@lowtide:~/scripts/database$ file blah
>>> blah: SQLite 3.x database
>>> anon@lowtide:~/scripts/database$ ls -lh blah
>>> -rw-r--r-- 1 anon anon 345M Mar 29 15:36 blah
>>> anon@lowtide:~/scripts/database$ time ./count blah
>>> table count: 114
>>> row count: 2099196
>>>
>>> real 0m0.263s
>>> user 0m0.092s
>>> sys 0m0.168s
>>> anon@lowtide:~/scripts/database$
>>
>>
>> Kewl, but...
>>
>> I calculated and reported 11 measures in 0.17 seconds.
>>
>> You did 2 in 0.26 seconds.
>>
>
> Yeah, it's slower.
>
>> ACCESSPLUSVBAEQUALSWIN
>>
>> And where's your code for 'count'?
>>
>
> I posted the files earlier in tarball. It included a README, the foo.sh
> script, and a "create" file for building a dummy database.
Eternal-september must've dropped the post.
> Here's the code for "count" (and remember, this is amateur hour):
Not to worry - I don't criticize others code (unless they're pricks
like Kohlmann or Fabian).
And if I can see possible improvements, it's because it's easier to edit
than to create.
> -------------------------------------
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> #include "sqlite3.h"
>
> #define BUFFER_SIZE 256
>
> int table_count_callback(void *,int , char **, char **);
> int table_names_callback(void *,int , char **, char **);
> int row_count_callback(void *,int , char **, char **);
>
> int row_count=0;
> int t_count=0;
> char table_names [1024*1024]={0};
>
> int main(int argc, char *argv[]) {
>
> sqlite3 * db;
> char * sErrMsg = 0;
> const char s[2] = "\n";
> char table_count_SQL [BUFFER_SIZE] = {0};
> char table_names_SQL [BUFFER_SIZE] = {0};
> char row_count_SQL [BUFFER_SIZE] = {0};
> char *token;
> char token_SQL [BUFFER_SIZE] = {0};
> char *filename;
>
> if(argc!=2)
> {
> fprintf(stderr,"argc!=2\n");
> fprintf(stderr,"usage: %s <database>\n",argv[0]);
> exit(1);
> }
>
> filename=argv[1];
>
> sqlite3_open(filename, &db);
>
> sprintf(table_count_SQL, "select count(*) from sqlite_master where type='table' and name!='sqlite_sequence'");
>
> sqlite3_exec(db, table_count_SQL, table_count_callback, &t_count, &sErrMsg);
>
> printf("table count: %d\n",t_count);
>
> sprintf(table_names_SQL, "select name from sqlite_master where type='table' and name!='sqlite_sequence'");
>
> sprintf(row_count_SQL, "select count(*) from (select name from sqlite_master where type='table' and name !='sqlite_sequence')");
>
> sqlite3_exec(db,"BEGIN TRANSACTION",NULL,NULL,&sErrMsg);
>
> sqlite3_exec(db, table_names_SQL, table_names_callback, &row_count, &sErrMsg);
>
> token = strtok(table_names,s);
>
> while(token!=NULL)
> {
> sprintf(token_SQL,"select count(*) from %s",token);
> sqlite3_exec(db, token_SQL, row_count_callback, &row_count, &sErrMsg);
> token=strtok(NULL,s);
> }
>
> sqlite3_exec(db, "END TRANSACTION", NULL, NULL, &sErrMsg);
>
> printf("row count: %d\n",row_count);
>
> sqlite3_close(db);
>
> return 0;
> }
>
> int table_count_callback(void *pArg,int argc,char **argv,char **columnNames)
> {
> *(int *)pArg+=atoi(argv[0]);
> return 0;
> }
>
> int table_names_callback(void *pArg,int argc,char **argv,char **columnNames)
> {
> strcat(table_names,*argv);
> strcat(table_names,"\n");
> return 0;
> }
>
> int row_count_callback(void *pArg,int argc,char **argv,char **columnNames)
> {
> int i=0;
> for (i=0;i<argc;i++)
> {
> *(int *)pArg+=atoi(argv[0]);
> }
> return 0;
> }
>
> -------------------------------------
Thanks.
At some point I'll get around to testing it, and see if I can update it
to count columns and indexes.
Back to comp.os.linux.advocacy | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Can anyone here defend LibreOffice crapware against the masterful MS Office? DFS <nospam@dfs.com> - 2016-03-26 18:50 -0400
Re: Can anyone here defend LibreOffice crapware against the masterful MS Office? John Gohde <john.h.gohde@gmail.com> - 2016-03-26 16:26 -0700
How to put off an appile funded idiot posting on behalf of microshaft crocporation 7 <7@enemygagets.com> - 2016-03-26 23:48 +0000
Re: Can anyone here defend LibreOffice crapware against the masterful MS Office? DFS <nospam@dfs.com> - 2016-03-26 20:06 -0400
Re: How to put off an appile funded idiot posting on behalf of microshaft crocporation Chris Ahlstrom <OFeem1987@teleworm.us> - 2016-03-26 20:12 -0400
Re: Can anyone here defend LibreOffice crapware against the masterful MS Office? DFS <nospam@dfs.com> - 2016-03-26 23:28 -0400
Re: Can anyone here defend LibreOffice crapware against the masterful M Office? "Henry" <henry@alpha.org> - 2016-03-27 13:56 +0200
Re: Can anyone here defend LibreOffice crapware against the masterful MS Office? owl <owl@rooftop.invalid> - 2016-03-27 18:37 +0000
Re: Can anyone here defend LibreOffice crapware against the masterful MS Office? DFS <nospam@dfs.com> - 2016-03-27 18:56 -0400
Re: Can anyone here defend LibreOffice crapware against the masterful MS Office? owl <owl@rooftop.invalid> - 2016-03-29 19:44 +0000
Re: Can anyone here defend LibreOffice crapware against the masterful MS Office? DFS <nospam@dfs.com> - 2016-03-29 16:23 -0400
Re: Can anyone here defend LibreOffice crapware against the masterful MS Office? owl <owl@rooftop.invalid> - 2016-03-29 20:43 +0000
Re: Can anyone here defend LibreOffice crapware against the masterful MS Office? DFS <nospam@dfs.com> - 2016-03-29 19:22 -0400
Re: Can anyone here defend LibreOffice crapware against the masterful MS Office? DFS <nospam@dfs.com> - 2016-04-02 16:11 -0400
How to put off an appile funded idiot posting on behalf of microshaft crocporation 7 <7@enemygadgets.com> - 2016-03-28 00:05 +0100
Re: How to put off an appile funded idiot posting on behalf of microshaft crocporation DFS <nospam@dfs.com> - 2016-03-27 19:50 -0400
Re: How to put off an appile funded idiot posting on behalf of microshaft crocporation 7 <7@enemygadgets.com> - 2016-03-28 15:55 +0100
Re: How to put off an appile funded idiot posting on behalf of microshaft crocporation chrisv <chrisv@nospam.invalid> - 2016-03-28 11:03 -0500
Re: Can anyone here defend LibreOffice crapware against the masterful MS Office? DFS <nospam@dfs.com> - 2016-03-29 09:24 -0400
Re: Can anyone here defend LibreOffice crapware against the masterful MS Office? DFS <nospam@dfs.com> - 2016-03-29 09:34 -0400
Re: Can anyone here defend LibreOffice crapware against the masterful MS Office? DFS <nospam@dfs.com> - 2016-03-29 09:29 -0400
Re: How to put off an appile funded idiot posting on behalf of microshaft crocporation Chris Ahlstrom <OFeem1987@teleworm.us> - 2016-03-27 19:56 -0400
Re: How to put off an appile funded idiot posting on behalf of microshaft crocporation DFS <nospam@dfs.com> - 2016-03-27 20:52 -0400
Re: Can anyone here defend LibreOffice crapware against the masterful MS Office? Fabian Russell <fb@zen.info> - 2016-03-27 07:43 +0000
Re: Can anyone here defend LibreOffice crapware against the masterful MS Office? Chris Ahlstrom <OFeem1987@teleworm.us> - 2016-03-27 07:19 -0400
Re: Can anyone here defend LibreOffice crapware against the masterful MS Office? Fabian Russell <fb@zen.info> - 2016-03-27 13:20 +0000
Can anyone here defend MS Office crapware? ronb <ronb02NOSPAM@gmail.com> - 2016-03-27 16:46 +0000
Re: Can anyone here defend LibreOffice crapware against the masterful M Office? "Henry" <henry@alpha.org> - 2016-03-27 14:06 +0200
Re: Can anyone here defend LibreOffice crapware against the masterful M Office? Takuya Saitoh <taka0038@gmail.com> - 2016-03-27 05:42 -0700
Re: Can anyone here defend LibreOffice crapware against the masterful MSOffice? "Ezekiel" <zeke@nosuchemail.com> - 2016-03-27 08:44 -0400
Re: Can anyone here defend LibreOffice crapware against the masterful MSOffice? "Dr. John Grubor" <grubor@grubor.invalid> - 2016-03-27 15:05 +0000
Re: Can anyone here defend LibreOffice crapware against the masterful MS Office? DFS <nospam@dfs.com> - 2016-03-27 12:16 -0400
Re: Can anyone here defend LibreOffice crapware against the masterful MS Office? DFS <nospam@dfs.com> - 2016-03-27 14:10 -0400
Re: Can anyone here defend LibreOffice crapware against the masterful MS Office? Fabian Russell <fb@zen.info> - 2016-03-27 13:10 +0000
csiph-web