Jump to content

Sqlite get2dtable no value return


Recommended Posts

Hi all i have this problem,
I need to call sometimes the function below   and i need return value outside.

But when i write _Arraydisp($aResult)  inside function show result, when i put outside nothing to show

 

Func _SqliteQuery($req)
    _SqlStart()
    $iRval = _SQLite_GetTable2d (-1, $req, $aResult, $iRows, $iColumns)
    _SQLite_Close()
    _SQLite_Shutdown()
EndFunc
Edited by Stacker
Link to comment
Share on other sites

You seem to startup and shutdown the engine at every query invokation, which is pretty wasteful. I hope your _SqlStart opens a DB.

Now your code doesn't make sense: $aResult isn't declared, just as $iRows and $iColumns, and nothing is retruned from the function.

Post full runable code and you'll surely get more useful help.

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)

Link to comment
Share on other sites

27 minutes ago, Stacker said:

I startup and shutdown at query function because i use once in 6-7 hour

That doesn't bring you anything valuable. You should startup and open at program launch, then close and shutdown at program termination.

Now if the resultset is empty that may be because your query is invalid or doesn't select any row. You don't check return code so you don't know. Another possibility is that your code overwrites the result array before you display it. Again, no code = no useful help.

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)

Link to comment
Share on other sites

Hi @Stacker

I have noticed you have a custom query with the same name as a standard AutoIt query... This is from the Help file:

_SQLite_Query(-1, "SELECT c FROM aTest ORDER BY a;", $hQuery) ; the query

All examples have the structure of (a) starting SQLite, (b) query, (c) process query, (d) SQLite Shutdown.

I am guessing at conflict between the name of your function and the built-in Autoit function.  Can you run this query separately?  Perhaps the issue is that SQLite3.dll is not present?  See here:

https://www.autoitscript.com/forum/topic/178823-sqlite-in-distros-33142-and-beta-33150/

Edit

I agree with @jchd you are not giving us enough to work with. More code, better examples...

Edited by Skysnake

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

2 minutes ago, Skysnake said:

I am guessing at conflict between the name of your function and the built-in Autoit function.

Are you sure? _SqliteQuery != _SQLite_Query and if two functions would have the same name, the script wouldn't run nor compile.

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)

Link to comment
Share on other sites

Don't rely on it!

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)

Link to comment
Share on other sites

@jchd, while we are here, how would one enumerate current SQLite connections?  Found this comment from 2011:

Quote

as of 2007, there is  no sqlite public api for querying  the number of open connections to a sqlite database

Do you have some advise, please? 

Skysnake

Why is the snake in the sky?

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

×
×
  • Create New...