Stacker Posted April 18, 2016 Share Posted April 18, 2016 (edited) 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 April 18, 2016 by Stacker Link to comment Share on other sites More sharing options...
jchd Posted April 18, 2016 Share Posted April 18, 2016 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 hereRegExp tutorial: enough to get startedPCRE 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 More sharing options...
Stacker Posted April 18, 2016 Author Share Posted April 18, 2016 Hi jchd, code is to long... I startup and shutdown at query function because i use once in 6-7 hour i declare the variable with Global $aResult, $iRows, $iColumns, $iRval,$req at the start of my script Link to comment Share on other sites More sharing options...
jchd Posted April 18, 2016 Share Posted April 18, 2016 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 hereRegExp tutorial: enough to get startedPCRE 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 More sharing options...
Skysnake Posted April 18, 2016 Share Posted April 18, 2016 (edited) 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 April 18, 2016 by Skysnake Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
jchd Posted April 18, 2016 Share Posted April 18, 2016 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 hereRegExp tutorial: enough to get startedPCRE 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 More sharing options...
Skysnake Posted April 18, 2016 Share Posted April 18, 2016 I bow before your superior reading skills. Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
jchd Posted April 18, 2016 Share Posted April 18, 2016 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 hereRegExp tutorial: enough to get startedPCRE 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 More sharing options...
Skysnake Posted April 18, 2016 Share Posted April 18, 2016 @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 More sharing options...
Stacker Posted April 18, 2016 Author Share Posted April 18, 2016 SOLVED - Sorry, today i need more coffe I reWrite code now variable $req"SELECT ...." is not argument of function. I call without arg. _SqliteQuery() _arraydisp working outside. Coffe work!! Link to comment Share on other sites More sharing options...
Skysnake Posted April 18, 2016 Share Posted April 18, 2016 LOL Glad we could help Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
Stacker Posted April 18, 2016 Author Share Posted April 18, 2016 Thank you Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now