Jump to content

Possibile elaborare sequenzialmente records


Mose
 Share

Recommended Posts

Il problema e' come leggere sequenzialmente i records di gruppi di record estratti da una tabella o di una intera tabella.

In altri linguaggi ci sono istruzioni del tipo Next, previuos, MoveNext...Movelast, ..., go top, go record etcetera

Qualcuno mi da' una dritta ?

Link to comment
Share on other sites

Translation: Italian (automatically detected) » English

Il problema e' come leggere sequenzialmente i records di gruppi di record estratti da una tabella o di una intera tabella. In altri linguaggi ci sono istruzioni del tipo Next, previuos, MoveNext...Movelast, ..., go top, go record etcetera Qualcuno mi da' una dritta ?

The problem, and 'how to read sequentially the records of groups of records taken from a table or a whole table.

In other languages there are instructions on the type Next, previuos, MoveNext MoveLast ..., ..., go top, go record etcetera

Somebody give me 'a straight?

didn't got what you want, Say In english and more clearly

Link to comment
Share on other sites

didn't got what you want, Say In english and more clearly

Ho una tabella con 20000 records.

Ciascun record contiene 20 campi.

Devo rielaborare solo alcuni campi.

Come leggere tutti i records della tabella, uno per volta, dal primo all'ultimo ?

Grazie

I have a table with 20,000 records.

Each record contains 20 fields.

I have to rework a few fields.

How to read all the records of the table, one by one, from first to last?

Thanks

Link to comment
Share on other sites

E possibilmente cerca di scrivere dei topic con il titolo in inglese (cosi' lo possono leggere tutti gli utenti) :)

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

mi prendi per i fondelli ?

take me back for?

No probabilmente non ha letto con attenzione la dimensioni della tabella

Ad ogni modo in che linguaggio e' ?

[...] ... btw what language is the table written in ?

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

_SQLite_FetchData retrieves one row at a time. To segment your query you can use LIMIT 0,20

#include <SQLite.au3>
#include <SQLite.dll.au3>

Local $hQuery, $aRow, $aNames
_SQLite_Startup ()
_SQLite_Open  () ; open  :memory: Database
_SQLite_Exec  (-1, "CREATE TABLE aTest  (a,b,c);")
_SQLite_Exec (-1,  "INSERT INTO aTest(a,b,c) VALUES  ('c','2','World');")
_SQLite_Exec (-1,  "INSERT INTO aTest(a,b,c) VALUES ('b','3','  ');")
_SQLite_Exec (-1, "INSERT INTO aTest(a,b,c)  VALUES ('a','1','Hello');")
_SQlite_Query (-1,  "SELECT ROWID,* FROM aTest ORDER BY a;", $hQuery)
_SQLite_FetchNames  ($hQuery, $aNames)
ConsoleWrite(StringFormat(" %-10s  %-10s  %-10s  %-10s ", $aNames[0], $aNames[1], $aNames[2],  $aNames[3]) & @CR)
While _SQLite_FetchData ($hQuery, $aRow) = $SQLITE_OK ; Read Out the  next Row
    ConsoleWrite(StringFormat(" %-10s  %-10s   %-10s  %-10s ", $aRow[0], $aRow[1],  $aRow[2], $aRow[3]) & @CR)
WEnd
_SQLite_Exec  (-1, "DROP TABLE  aTest;")
_SQLite_Close ()
_SQLite_Shutdown  ()
Link to comment
Share on other sites

Thanks weaponx

_SQLite_FetchData (retrieves one row at a time) is OK !!!

Grazie weaponx

_SQLite_FetchData (elabora una riga per volta) e' la soluzione.

Excuse me

The solution, for me is:

;

; LetturaSequenzialeRecords.au3

; Esempio di elaborazione sequenziale dei records di una tabella SQLite3 con autoit3

; legge solo alcuni record (qui dal 3° al 7°)

; $nLeggoDa e $nLeggoFinoA determinano quali record leggere

;

;

#include <SQLite.au3>

#include <SQLite.dll.au3>

Local $hQuery, $aNames, $aRow

$sDbFile = "atti.db"

_SQLite_Startup()

_SQLite_Open($sDbFile)

_SQlite_Query (-1, "SELECT ROWID,* FROM TblImport;", $hQuery)

;

; Show Table (using SQLite3.dll)

_SQLite_FetchNames ($hQuery, $aNames) ; Read out Column Names

;

$nConta = 0 ; records counter

$nLeggoDa = 3 ; start reading

$nLeggoFinoA =7 ; stop reading

While 1 ; start loop for reading records

$nConta += 1

IF _SQLite_FetchData ($hQuery, $aRow) = $SQLITE_OK THEN ; record OK

IF $nConta = 1 Then ; display field header only first record

ConsoleWrite($aNames[0] & " " & $aNames[1] & " " & $aNames[2] & " " & $aNames[3] & " " & $aNames[4] & " " & $aNames[5] & " " & @CR)

Endif

IF $nConta >= $nLeggoDa and $nConta <= $nLeggoFinoA THEN

; Here Your Instructions (QUI LE ISTRUZIONI PER ELABORARE CIASCUN RECORD)

; example (esempio)

ConsoleWrite($aRow[0] & " " & $aRow[1] & " " & $aRow[2] & " " & $aRow[3] & " " & $aRow[4] & " " & $aRow[5] & " " & @CR)

;

endif

Else

ExitLoop

endif

WEnd

_SQLite_Close ()

_SQLite_Shutdown ()

;~ Output:

; rowid Column_1 Column_2 Column_3 Column_4 Column_5

; 3 1996 001 DI 810 139,43

; 4 1997 001 DI 93 144,59

; 5 1997 001 DI 94 144,59

; 6 1997 001 DI 1003 322,20

; 7 1997 003 DI 295 263,38

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...