Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

The world will end in 5 minutes. Please log out.


computers / comp.os.vms / Re: From index-sequential file to SQLite database

SubjectAuthor
* From index-sequential file to SQLite databaseArne Vajhøj
`- Re: From index-sequential file to SQLite databaseDavid Jones

1
From index-sequential file to SQLite database

<sc063o$17hv$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=15735&group=comp.os.vms#15735

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!aioe.org!5Avcpu9drOe6MAssky6/+Q.user.gioia.aioe.org.POSTED!not-for-mail
From: arn...@vajhoej.dk (Arne Vajhøj)
Newsgroups: comp.os.vms
Subject: From index-sequential file to SQLite database
Date: Mon, 5 Jul 2021 19:54:34 -0400
Organization: Aioe.org NNTP Server
Lines: 39
Message-ID: <sc063o$17hv$1@gioia.aioe.org>
NNTP-Posting-Host: 5Avcpu9drOe6MAssky6/+Q.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@aioe.org
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
X-Mozilla-News-Host: news://nntp.aioe.org:119
 by: Arne Vajhøj - Mon, 5 Jul 2021 23:54 UTC

This topic has come up a few times.

Now I have written something about it.

A conversion done by Python code running in JVM via Jython
using mapped Java classes:

IS record--(map)--Java class--(automap)--Java class--(map)--DB tables

Also showing some before code in:
* Cobol
* Pascal
and some after code in:
* C
* Pascal
* Python
* PHP
* Java (JDBC)
* Java (JPA)

I am pretty sure that it will be an interesting read for anyone
considering migrating data from index-sequential files to
SQLite (or other relational database).

You may not necessarily like the approach used, but even
if you decide against using the tripple mapping approach
then it may still be interesting as part of the due diligence.

And all the insert and list examples are valid no matter
how the conversion is done.

Enough talk - link:

https://www.vajhoej.dk/arne/articles/vmstd3.html

Lot of code. Almost no comments. And the code may not always be
good for the languages that I do not know well (like Cobol).

Arne

Re: From index-sequential file to SQLite database

<ea94808b-8ef3-4b7e-bd63-3a924d5cb423n@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=15749&group=comp.os.vms#15749

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:ac8:5949:: with SMTP id 9mr15155189qtz.222.1625578415696;
Tue, 06 Jul 2021 06:33:35 -0700 (PDT)
X-Received: by 2002:a37:66d7:: with SMTP id a206mr13651936qkc.477.1625578415499;
Tue, 06 Jul 2021 06:33:35 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.vms
Date: Tue, 6 Jul 2021 06:33:35 -0700 (PDT)
In-Reply-To: <sc063o$17hv$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=74.140.8.188; posting-account=CO-_tAoAAACjjs2KLAw3xVKCy6Z_J3VK
NNTP-Posting-Host: 74.140.8.188
References: <sc063o$17hv$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ea94808b-8ef3-4b7e-bd63-3a924d5cb423n@googlegroups.com>
Subject: Re: From index-sequential file to SQLite database
From: osuvma...@gmail.com (David Jones)
Injection-Date: Tue, 06 Jul 2021 13:33:35 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: David Jones - Tue, 6 Jul 2021 13:33 UTC

On Monday, July 5, 2021 at 7:54:38 PM UTC-4, Arne Vajhøj wrote:
> This topic has come up a few times.
>
> Now I have written something about it.
>
> A conversion done by Python code running in JVM via Jython
> using mapped Java classes:
>
> IS record--(map)--Java class--(automap)--Java class--(map)--DB tables
>
> Also showing some before code in:
> * Cobol
> * Pascal
> and some after code in:
> * C
> * Pascal
> * Python
> * PHP
> * Java (JDBC)
> * Java (JPA)

I first started using indexed files in Fortran, where it was sometimes as simple as adding a "KEY="
clause to the READ statement.

For SQLite applications, my C programs use an intermediate library that encapsulates the SQLite calls
in a statement storage object. The fiddly calls to sqlite3_bind... functions are handled by the execute()
method and those to sqlite3_column_... functions by the next_row() method:

#include "statement_store.h"
sqlite3 *db_cnx;
sps_store sps;
struct sps_context *ctx;
int emp_num, dept_num, rc;
char *first, *last;

rc = sqlite3_open ( "payroll.db", &db_cnx );
sps = sps_create_store (db_cnx, 0);
sps_define (sps, "fetch-emp-by-last",
"SELECT * FROM employee WHERE last LIKE ?1 ORDER by last_name,first_name", "s");

ctx = sps_execute (sps, "fetch-emp-by-last", "%");
while (sps_next_row(ctx, "itti", &emp_num, &first, &last, &dept_num))
{
printf("%8d %-12s %-15s %5d\n", emp_num, first, last, dept_num);
free ( first );
free ( last );
}

if ( ctx->rc != SQLITE_DONE ) printf ( "Error fetching rows!\n" );
printf ("Rows retrieved: %d\n", ctx->count);
rc = sps_rundown(ctx);

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor