Sign in to follow this  
Followers 0
Anna82

extract access database schema

4 posts in this topic

hi,

i'm looking for some lines of code to extract the database (table) schema from an access database.

i tried the access.udf, but can't access the schema

can anyone give me a hint?

thanks

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Anna,

I use the following set of functions for most of my Accedd DB stuff...

func table_exists($tbl)
local $rows, $nbrows, $nbcols, $ret
    $ret = _SQLite_GetTable2d(-1, "select * from sqlite_master where name = " & "'" & $tbl  & "'" & ";", $rows, $nbrows, $nbcols)
    If @error Then ConsoleWrite(@error & ' ' & @extended & ' ' & $ret & @LF)
if $nbrows > 0 then
  return true
Else
  return False
endif
endfunc
func table_list()
local $rows, $nbrows, $nbcols
    $ret = _SQLite_GetTable2d(-1, "select * from sqlite_master;", $rows, $nbrows, $nbcols,1000)
    If @error Then ConsoleWrite(@error & ' ' & @extended & ' ' & $ret & @LF)
return $rows
endfunc
func column_list($tbl)
local $rows, $nbrows, $nbcols
    $ret = _SQLite_GetTable2d(-1, "pragma table_info(" & $tbl & ");", $rows, $nbrows, $nbcols)
    If @error Then ConsoleWrite(@error & ' ' & @extended & ' ' & $ret & @LF)
return $rows
endfunc
func table_clear($tbl)
local $ret
if not _SQLite_Exec (-1, "delete from " & $tbl & ";") = $sqlite_ok then MsgBox(16, "SQLite Error", _SQLite_ErrMsg ())
    If @error Then ConsoleWrite(@error & ' ' & @extended & ' ' & $ret & @LF)
endfunc

kylomas

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

Are you actually using _SQLite_* functions to access an Access database with any success?


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Anna, Jchd,

Sorry !!! My mistake, I converted everything form access to sqlite last year.

Anna,

Access has the same sort of functionality, just do a google search for ADOX and you will get vbscript examples. THese are easily converted to AutoIT.

Again, sorry for the misleading info,

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
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
Sign in to follow this  
Followers 0