Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - KingRat

Pages: [1] 2
1
Programs / Re: ODBC in QB64 (Windows)
« on: October 01, 2021, 04:29:50 pm »
That´s a nice approach!

Some time ago I was studying a way to work with sqlite3, I think it would be a nice feature for QB...
Btw I´ll follow this thread!






2
Programs / Re: The GuiTools Framework
« on: June 14, 2019, 01:24:07 pm »
RhoSigma, I managed to get it running this morning, I noticed that the Internal folder had outdated stuff inside, I´ve just deleted it and extracted it again from the 1.3 zip and voila!

By the way, you coded some serious stuff here, Great Job!
I liked the Amiga style, I think this kind of interface still has use today!

THX, 73´s!


3
Programs / Re: The GuiTools Framework
« on: June 14, 2019, 03:31:08 am »
I´ve placed the folder in into my QB64 folder as recomended.

By the way, It was a long night, better take a nap now!

73´s everyone!

4
Programs / Re: The GuiTools Framework
« on: June 14, 2019, 03:07:28 am »
Hi everyone!

I´ve downloaded it and I extracted the folder to my qb64 directory, but It doesn´t compiles the demos :\

It returns:
Quote
C:\Users\Sti\AppData\Local\Temp\ccVpsX2N.o:qbx.cpp:(.text+0x23): undefined reference to `__glutInitWithExit'
C:\Users\Sti\AppData\Local\Temp\ccVpsX2N.o:qbx.cpp:(.text+0x46): undefined reference to `__glutCreateWindowWithExit'
C:\Users\Sti\AppData\Local\Temp\ccVpsX2N.o:qbx.cpp:(.text+0x68): undefined reference to `__glutCreateMenuWithExit'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0x23): undefined reference to `__glutInitWithExit'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0x46): undefined reference to `__glutCreateWindowWithExit'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0x68): undefined reference to `__glutCreateMenuWithExit'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0x31211): undefined reference to `glutPostRedisplay'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0x31226): undefined reference to `glutTimerFunc'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0x69442): undefined reference to `glutSetCursor'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0x69695): undefined reference to `glutSetCursor'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0x69a62): undefined reference to `glutWarpPointer'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xa4a60): undefined reference to `glutGet'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xa4aae): undefined reference to `glutGet'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xa4af7): undefined reference to `glutIconifyWindow'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xaecc7): undefined reference to `glutGet'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xaecd3): undefined reference to `glutGet'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xaed10): undefined reference to `glutGet'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xaed1c): undefined reference to `glutGet'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xaed28): undefined reference to `glutGet'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xaeda5): undefined reference to `glutPositionWindow'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xaedc1): undefined reference to `glutGet'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xaedd0): undefined reference to `glutGet'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xaeddd): undefined reference to `glutGet'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xaedea): undefined reference to `glutGet'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xaee1e): undefined reference to `glutPositionWindow'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xba9af): undefined reference to `glutShowWindow'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xba9d7): undefined reference to `glutHideWindow'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xbc241): undefined reference to `glutGetModifiers'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xbc57e): undefined reference to `glutPostRedisplay'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xbc5cf): undefined reference to `glutTimerFunc'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xbfca8): undefined reference to `glutReshapeWindow'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xbfcad): undefined reference to `glutPostRedisplay'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xbfcf6): undefined reference to `glutReshapeWindow'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xbfcfb): undefined reference to `glutPostRedisplay'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xbfd98): undefined reference to `glutReshapeWindow'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xbfd9d): undefined reference to `glutPostRedisplay'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xbfdc2): undefined reference to `glutFullScreen'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xc0e61): undefined reference to `glutSwapBuffers'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xc1cc0): undefined reference to `glutSetWindowTitle'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xc440e): undefined reference to `glutInitDisplayMode'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xc441d): undefined reference to `glutInitWindowSize'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xc4427): undefined reference to `glutGet'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xc44dd): undefined reference to `glutDisplayFunc'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xc44f4): undefined reference to `glutTimerFunc'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xc4500): undefined reference to `glutKeyboardFunc'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xc450c): undefined reference to `glutKeyboardUpFunc'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xc4518): undefined reference to `glutSpecialFunc'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xc4524): undefined reference to `glutSpecialUpFunc'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xc4530): undefined reference to `glutMouseFunc'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xc453c): undefined reference to `glutMotionFunc'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xc4548): undefined reference to `glutPassiveMotionFunc'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xc4554): undefined reference to `glutReshapeFunc'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xc4560): undefined reference to `glutMouseWheelFunc'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xc4565): undefined reference to `glutMainLoop'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xc9ffd): undefined reference to `glutDisplayFunc'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xca014): undefined reference to `glutTimerFunc'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xca020): undefined reference to `glutKeyboardFunc'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xca02c): undefined reference to `glutKeyboardUpFunc'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xca038): undefined reference to `glutSpecialFunc'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xca044): undefined reference to `glutSpecialUpFunc'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xca050): undefined reference to `glutMouseFunc'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xca05c): undefined reference to `glutMotionFunc'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xca068): undefined reference to `glutPassiveMotionFunc'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xca074): undefined reference to `glutReshapeFunc'
libqb\os\win\libqb_1_3_000001000110.o:libqb.cpp:(.text+0xca080): undefined reference to `glutMouseWheelFunc'
collect2.exe: error: ld returned 1 exit status

Any idea?!?

5
QB64 Discussion / Re: I need some help with Sqlite3 DLL, plz.
« on: November 01, 2018, 07:04:04 pm »
Hi Folks!

Quote
Tuning on the error
https://sqliteviewer.com/blog/how-to-fix-sqlite-error-code-21/

The text still brings me to the sqlite3*, the same stuff I was trying to figure out...

Quote
Would it help to use a tool such as dllexp.exe from Nirsoft to view the exported functions? I think the tool can look into the DLL in further detail, perhaps the information you need can be extracted from using dllexp.exe or pelook.exe or some other DLL dumping tool?

Nice output you got, thanks! But the functions that the DLL exports isn´t the actual problem, aswe have the source code, but the way to deal with it in a QB64 code.
Cause qb64 dont support callback functions and que need to point to a sqlite3 struct....

Im still trying in my spare time, I need such a exercise to came back to programming and stuff and I think a sqlite3 will be a nice feature for this nice language..

Thanks!

6
QB64 Discussion / Re: I need some help with Sqlite3 DLL, plz.
« on: October 27, 2018, 03:22:10 pm »
Hi Tempo!

Quote
Hi KingRat
do you run for Halloween Challenge? https://www.qb64.org/forum/index.php?topic=694.0
It lasts only 4 days....
No man! I´m not running. I think I´m not good enought to these kind of stuff... I mean, I´ll not bring anything new to the table...

Quote
1. has QueryStr a right SQL command into it?
Yes!
That query come from a query example I found at sqlite site.
And I´ve tryied both ways, sending the string offset QueryPtr and sending the string itself QueryStr.

Quote
2. is possible to make a query with a void database?
I think we can use a query into a void database to create tables (this is my for now) to start working with it.

Thanks again brother!

7
QB64 Discussion / Re: I need some help with Sqlite3 DLL, plz.
« on: October 27, 2018, 11:13:41 am »
Just to keep the topic running.
Im still trying.... I tryed some C/C++ stuff at a .H file....
I´ve downloaded the amalgmation version of sqlite3 to embed it on the aplication but the C++ compiler behind qb64 returns that there were a #endif without a #if...

The following code is a scrap that Im using to try to work with the DLL, I wrote a simple function to return the actual error returned by the DLL functions.

If someone knows how to deal with it please reply!

Code: QB64: [Select]
  1.     FUNCTION StartSqlite% ALIAS sqlite3_initialize ()
  2.     FUNCTION StopSqlite% ALIAS sqlite3_shutdown ()
  3.     FUNCTION SqliteLibVersion& ALIAS sqlite3_libversion_number ()
  4.     FUNCTION OpenDb% ALIAS sqlite3_open (filename AS STRING, ppDb AS _OFFSET)
  5.     FUNCTION CloseDb% ALIAS sqlite3_close ()                        
  6.    'FUNCTION SqliteExec& ALIAS sqlite3_exec (sqlite3 AS _OFFSET, sql AS STRING, CbackPtr AS _UNSIGNED LONG, Vd AS LONG, errmsg AS STRING) ' This one needs a callback function.
  7.     FUNCTION Prepare% ALIAS sqlite3_prepare_v2 (Db AS _OFFSET, zSql AS STRING, nByte AS INTEGER, stmt AS _OFFSET, pzTail AS _OFFSET) ' instead of using sqlite3_exec() witch is a convenience wrapper, we can compile query statement using this funcion an then execute it using step(), this is the way Im going...
  8.  
  9. '-------------------------------------------------------------------------------------------------------------------------------------------------
  10.  
  11. PRINT "Start DB engine"
  12. PRINT ResultCode(StartSqlite)
  13.  
  14. Db = _OFFSET(DbVar)
  15.  
  16. PRINT "Open DB"
  17. PRINT ResultCode(OpenDb%("tst.db", Db))
  18.  
  19. 'CPtr = _OFFSET(C)
  20.  
  21. DIM QueryStr AS STRING * 256
  22. DIM QueryPtr AS _OFFSET
  23. QueryStr = "CREATE TABLE Teste(Id Int, Nome Varchar)"
  24. QueryPtr = _OFFSET(QueryStr)
  25.  
  26. DIM Stmt AS LONG
  27. DIM Tail AS LONG
  28.  
  29. PRINT "Query preparation."
  30. PRINT ResultCode(Prepare(Db, QueryStr, 256, QueryPtr, Tail))
  31.  
  32. PRINT "Close DB"
  33. PRINT ResultCode(CloseDb%)  ' Here we should pass ppDb as a reference of the DB to be closed by sqlite3_close(), I´ve tryed LONG, _UNSIGNED LONG and _OFFSET but it still returns Sqlite3 Misuse, leaving empty returns OK
  34.  
  35. PRINT "Stop DB engine"
  36. PRINT ResultCode(StopSqlite)
  37.  
  38.  
  39.  
  40.  
  41.  
  42. FUNCTION ResultCode$ (Code AS INTEGER)
  43.  
  44.     SELECT CASE Code
  45.  
  46.         CASE 0
  47.             ResultCode$ = "SQLITE_OK"
  48.         CASE 1
  49.             ResultCode$ = "SQLITE_ERROR"
  50.         CASE 2
  51.             ResultCode$ = "SQLITE_INTERNAL"
  52.         CASE 3
  53.             ResultCode$ = "SQLITE_PERM"
  54.         CASE 4
  55.             ResultCode$ = "SQLITE_ABORT"
  56.         CASE 5
  57.             ResultCode$ = "SQLITE_BUSY"
  58.         CASE 6
  59.             ResultCode$ = "SQLITE_LOCKED"
  60.         CASE 7
  61.             ResultCode$ = "SQLITE_NOMEM"
  62.         CASE 8
  63.             ResultCode$ = "SQLITE_READONLY"
  64.         CASE 9
  65.             ResultCode$ = "SQLITE_INTERRUPT"
  66.         CASE 10
  67.             ResultCode$ = "SQLITE_IOERR"
  68.         CASE 11
  69.             ResultCode$ = "SQLITE_CORRUPT"
  70.         CASE 12
  71.             ResultCode$ = "SQLITE_NOTFOUND"
  72.         CASE 13
  73.             ResultCode$ = "SQLITE_FULL"
  74.         CASE 14
  75.             ResultCode$ = "SQLITE_CANTOPEN"
  76.         CASE 15
  77.             ResultCode$ = "SQLITE_PROTOCOL"
  78.         CASE 16
  79.             ResultCode$ = "SQLITE_EMPTY"
  80.         CASE 17
  81.             ResultCode$ = "SQLITE_SCHEMA"
  82.         CASE 18
  83.             ResultCode$ = "SQLITE_TOOBIG"
  84.         CASE 19
  85.             ResultCode$ = "SQLITE_CONSTRAINT"
  86.         CASE 20
  87.             ResultCode$ = "SQLITE_MISMATCH"
  88.         CASE 21
  89.             ResultCode$ = "SQLITE_MISUSE"
  90.         CASE 22
  91.             ResultCode$ = "SQLITE_NOLFS"
  92.         CASE 23
  93.             ResultCode$ = "SQLITE_AUTH"
  94.         CASE 24
  95.             ResultCode$ = "SQLITE_FORMAT"
  96.         CASE 25
  97.             ResultCode$ = "SQLITE_RANGE"
  98.         CASE 26
  99.             ResultCode$ = "SQLITE_NOTADB"
  100.         CASE 27
  101.             ResultCode$ = "SQLITE_NOTICE"
  102.         CASE 28
  103.             ResultCode$ = "SQLITE_WARNING"
  104.         CASE 100
  105.             ResultCode$ = "SQLITE_ROW"
  106.         CASE 101
  107.             ResultCode$ = "SQLITE_DONE"
  108.  
  109.     END SELECT
  110.  
  111.  

8
Programs / Re: Simple Port Scanner
« on: October 25, 2018, 01:39:26 pm »
Some considerations.

Im really excited about QB64, but I have to admit that this simple code became very slow, and TaskManager shows about 33 megs of RAM while execution.

Some tips for QB64 optimization?

Thanks!

9
Programs / Simple Port Scanner
« on: October 25, 2018, 01:35:08 pm »
I wrote this little code while I was reading the QB64 Wiki, just to figure out the _OPENCLIENT basics.

Code: QB64: [Select]
  1. 'Simple scanner
  2. 'This could be a little faster :/
  3. FOR port = 0 TO 65535
  4.     port$ = STR$(port)
  5.     _TITLE ("Scanning port " + port$ + " of 35535")
  6.     p = _OPENCLIENT("TCP/IP:" + port$ + ":localhost")
  7.     IF p THEN
  8.         PRINT port$ + " - listening!"
  9.     END IF
  10.     CLOSE p
  11. NEXT port
  12.  
  13.  

10
QB64 Discussion / Re: I need some help with Sqlite3 DLL, plz.
« on: October 22, 2018, 03:28:21 pm »
Hi TempodiBasic!

This is the same file I posted in the first message at this topic. I was travelling, now Im back I´ll restart coding again.

Thanks again!

11
QB64 Discussion / Re: I need some help with Sqlite3 DLL, plz.
« on: October 17, 2018, 06:44:01 pm »
Yes, I got your code here
I did some experiences with sqlite3_open function but I deleted it to post here (thats the blank line in the declare library part in my code).
I´ll be playing with that again using long as ppDb, cause I was using offset.

Thanks again!

12
QB64 Discussion / Re: I need some help with Sqlite3 DLL, plz.
« on: October 17, 2018, 05:48:48 pm »
Thanks for reply my topic, TempodiBasic!!!

I´m into the sqlite documentation pages for three days now... :/

I´m trying to isolate the sqlite3 struct by hand from its source code, but the bad thing about these "opaque structs" is that the typedefs are not located at the same block....

Here is a small amount of what´s going on!

Code: QB64: [Select]
  1. typedef sqlite_int64 i64;          /* 8-byte signed integer */
  2. typedef sqlite_uint64 u64;         /* 8-byte unsigned integer */
  3. typedef UINT32_TYPE u32;           /* 4-byte unsigned integer */
  4. typedef UINT16_TYPE u16;           /* 2-byte unsigned integer */
  5. typedef INT16_TYPE i16;            /* 2-byte signed integer */
  6. typedef UINT8_TYPE u8;             /* 1-byte unsigned integer */
  7. typedef INT8_TYPE i8;
  8.  
  9. struct CollSeq {
  10.   char *zName;          /* Name of the collating sequence, UTF-8 encoded */
  11.   u8 enc;               /* Text encoding handled by xCmp() */
  12.   void *pUser;          /* First argument to xCmp() */
  13.   int (*xCmp)(void*,int, const void*, int, const void*);
  14.   void (*xDel)(void*);  /* Destructor for pUser */
  15. };
  16.  
  17. typedef void (*sqlite3_syscall_ptr)(void);
  18.  
  19. #ifdef SQLITE_INT64_TYPE
  20.   typedef SQLITE_INT64_TYPE sqlite_int64;
  21. # ifdef SQLITE_UINT64_TYPE
  22.     typedef SQLITE_UINT64_TYPE sqlite_uint64;
  23. # else  
  24.     typedef unsigned SQLITE_INT64_TYPE sqlite_uint64;
  25. #elif defined(_MSC_VER) || defined(__BORLANDC__)
  26.   typedef __int64 sqlite_int64;
  27.   typedef unsigned __int64 sqlite_uint64;
  28. #else
  29.   typedef long long int sqlite_int64;
  30.   typedef unsigned long long int sqlite_uint64;
  31. #endif
  32. typedef sqlite_int64 sqlite3_int64;
  33. typedef sqlite_uint64 sqlite3_uint64;
  34.  
  35. struct sqlite3_file {
  36.   const struct sqlite3_io_methods *pMethods;  /* Methods for an open file */
  37. };
  38.  
  39. struct sqlite3_vfs {
  40.   int iVersion;            /* Structure version number (currently 3) */
  41.   int szOsFile;            /* Size of subclassed sqlite3_file */
  42.   int mxPathname;          /* Maximum file pathname length */
  43.   sqlite3_vfs *pNext;      /* Next registered VFS */
  44.   const char *zName;       /* Name of this virtual file system */
  45.   void *pAppData;          /* Pointer to application-specific data */
  46.   int (*xOpen)(sqlite3_vfs*, const char *zName, sqlite3_file*,
  47.                int flags, int *pOutFlags);
  48.   int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir);
  49.   int (*xAccess)(sqlite3_vfs*, const char *zName, int flags, int *pResOut);
  50.   int (*xFullPathname)(sqlite3_vfs*, const char *zName, int nOut, char *zOut);
  51.   void *(*xDlOpen)(sqlite3_vfs*, const char *zFilename);
  52.   void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg);
  53.   void (*(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol))(void);
  54.   void (*xDlClose)(sqlite3_vfs*, void*);
  55.   int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut);
  56.   int (*xSleep)(sqlite3_vfs*, int microseconds);
  57.   int (*xCurrentTime)(sqlite3_vfs*, double*);
  58.   int (*xGetLastError)(sqlite3_vfs*, int, char *);
  59.   /*
  60.   ** The methods above are in version 1 of the sqlite_vfs object
  61.   ** definition.  Those that follow are added in version 2 or later
  62.   */
  63.   int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*);
  64.   /*
  65.   ** The methods above are in versions 1 and 2 of the sqlite_vfs object.
  66.   ** Those below are for version 3 and greater.
  67.   */
  68.   int (*xSetSystemCall)(sqlite3_vfs*, const char *zName, sqlite3_syscall_ptr);
  69.   sqlite3_syscall_ptr (*xGetSystemCall)(sqlite3_vfs*, const char *zName);
  70.   const char *(*xNextSystemCall)(sqlite3_vfs*, const char *zName);
  71.   /*
  72.   ** The methods above are in versions 1 through 3 of the sqlite_vfs object.
  73.   ** New fields may be appended in future versions.  The iVersion
  74.   ** value will increment whenever this happens.
  75.   */
  76. };
  77.  
  78. struct sqlite3 {
  79.   sqlite3_vfs *pVfs;            /* OS Interface */
  80.   struct Vdbe *pVdbe;           /* List of active virtual machines */
  81.   CollSeq *pDfltColl;           /* The default collating sequence (BINARY) */
  82.   sqlite3_mutex *mutex;         /* Connection mutex */
  83.   Db *aDb;                      /* All backends */
  84.   int nDb;                      /* Number of backends currently in use */
  85.   u32 mDbFlags;                 /* flags recording internal state */
  86.   u32 flags;                    /* flags settable by pragmas. See below */
  87.   i64 lastRowid;                /* ROWID of most recent insert (see above) */
  88.   i64 szMmap;                   /* Default mmap_size setting */
  89.   u32 nSchemaLock;              /* Do not reset the schema when non-zero */
  90.   unsigned int openFlags;       /* Flags passed to sqlite3_vfs.xOpen() */
  91.   int errCode;                  /* Most recent error code (SQLITE_*) */
  92.   int errMask;                  /* & result codes with this before returning */
  93.   int iSysErrno;                /* Errno value from last system error */
  94.   u16 dbOptFlags;               /* Flags to enable/disable optimizations */
  95.   u8 enc;                       /* Text encoding */
  96.   u8 autoCommit;                /* The auto-commit flag. */
  97.   u8 temp_store;                /* 1: file 2: memory 0: default */
  98.   u8 mallocFailed;              /* True if we have seen a malloc failure */
  99.   u8 bBenignMalloc;             /* Do not require OOMs if true */
  100.   u8 dfltLockMode;              /* Default locking-mode for attached dbs */
  101.   signed char nextAutovac;      /* Autovac setting after VACUUM if >=0 */
  102.   u8 suppressErr;               /* Do not issue error messages if true */
  103.   u8 vtabOnConflict;            /* Value to return for s3_vtab_on_conflict() */
  104.   u8 isTransactionSavepoint;    /* True if the outermost savepoint is a TS */
  105.   u8 mTrace;                    /* zero or more SQLITE_TRACE flags */
  106.   u8 noSharedCache;             /* True if no shared-cache backends */
  107.   u8 nSqlExec;                  /* Number of pending OP_SqlExec opcodes */
  108.   int nextPagesize;             /* Pagesize after VACUUM if >0 */
  109.   u32 magic;                    /* Magic number for detect library misuse */
  110.   int nChange;                  /* Value returned by sqlite3_changes() */
  111.   int nTotalChange;             /* Value returned by sqlite3_total_changes() */
  112.   int aLimit[SQLITE_N_LIMIT];   /* Limits */
  113.   int nMaxSorterMmap;           /* Maximum size of regions mapped by sorter */
  114.   struct sqlite3InitInfo {      /* Information used during initialization */
  115.     int newTnum;                /* Rootpage of table being initialized */
  116.     u8 iDb;                     /* Which db file is being initialized */
  117.     u8 busy;                    /* TRUE if currently initializing */
  118.     unsigned orphanTrigger : 1; /* Last statement is orphaned TEMP trigger */
  119.     unsigned imposterTable : 1; /* Building an imposter table */
  120.     unsigned reopenMemdb : 1;   /* ATTACH is really a reopen using MemDB */
  121.   } init;
  122.   int nVdbeActive;              /* Number of VDBEs currently running */
  123.   int nVdbeRead;                /* Number of active VDBEs that read or write */
  124.   int nVdbeWrite;               /* Number of active VDBEs that read and write */
  125.   int nVdbeExec;                /* Number of nested calls to VdbeExec() */
  126.   int nVDestroy;                /* Number of active OP_VDestroy operations */
  127.   int nExtension;               /* Number of loaded extensions */
  128.   void **aExtension;            /* Array of shared library handles */
  129.   int (*xTrace)(u32,void*,void*,void*);     /* Trace function */
  130.   void *pTraceArg;                          /* Argument to the trace function */
  131.   void (*xProfile)(void*,const char*,u64);  /* Profiling function */
  132.   void *pProfileArg;                        /* Argument to profile function */
  133.   void *pCommitArg;                 /* Argument to xCommitCallback() */
  134.   int (*xCommitCallback)(void*);    /* Invoked at every commit. */
  135.   void *pRollbackArg;               /* Argument to xRollbackCallback() */
  136.   void (*xRollbackCallback)(void*); /* Invoked at every commit. */
  137.   void *pUpdateArg;
  138.   void (*xUpdateCallback)(void*,int, const char*,const char*,sqlite_int64);
  139. #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
  140.   void *pPreUpdateArg;          /* First argument to xPreUpdateCallback */
  141.   void (*xPreUpdateCallback)(   /* Registered using sqlite3_preupdate_hook() */
  142.     void*,sqlite3*,int,char const*,char const*,sqlite3_int64,sqlite3_int64
  143.   );
  144.   PreUpdate *pPreUpdate;        /* Context for active pre-update callback */
  145. #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */
  146. #ifndef SQLITE_OMIT_WAL
  147.   int (*xWalCallback)(void *, sqlite3 *, const char *, int);
  148.   void *pWalArg;
  149. #endif
  150.   void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*);
  151.   void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*);
  152.   void *pCollNeededArg;
  153.   sqlite3_value *pErr;          /* Most recent error message */
  154.   union {
  155.     volatile int isInterrupted; /* True if sqlite3_interrupt has been called */
  156.     double notUsed1;            /* Spacer */
  157.   } u1;
  158.   Lookaside lookaside;          /* Lookaside malloc configuration */
  159. #ifndef SQLITE_OMIT_AUTHORIZATION
  160.   sqlite3_xauth xAuth;          /* Access authorization function */
  161.   void *pAuthArg;               /* 1st argument to the access auth function */
  162. #endif
  163. #ifndef SQLITE_OMIT_PROGRESS_CALLBACK
  164.   int (*xProgress)(void *);     /* The progress callback */
  165.   void *pProgressArg;           /* Argument to the progress callback */
  166.   unsigned nProgressOps;        /* Number of opcodes for progress callback */
  167. #endif
  168. #ifndef SQLITE_OMIT_VIRTUALTABLE
  169.   int nVTrans;                  /* Allocated size of aVTrans */
  170.   Hash aModule;                 /* populated by sqlite3_create_module() */
  171.   VtabCtx *pVtabCtx;            /* Context for active vtab connect/create */
  172.   VTable **aVTrans;             /* Virtual tables with open transactions */
  173.   VTable *pDisconnect;          /* Disconnect these in next sqlite3_prepare() */
  174. #endif
  175.   Hash aFunc;                   /* Hash table of connection functions */
  176.   Hash aCollSeq;                /* All collating sequences */
  177.   BusyHandler busyHandler;      /* Busy callback */
  178.   Db aDbStatic[2];              /* Static space for the 2 default backends */
  179.   Savepoint *pSavepoint;        /* List of active savepoints */
  180.   int busyTimeout;              /* Busy handler timeout, in msec */
  181.   int nSavepoint;               /* Number of non-transaction savepoints */
  182.   int nStatement;               /* Number of nested statement-transactions  */
  183.   i64 nDeferredCons;            /* Net deferred constraints this transaction. */
  184.   i64 nDeferredImmCons;         /* Net deferred immediate constraints */
  185.   int *pnBytesFreed;            /* If not NULL, increment this in DbFree() */
  186. #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY
  187.   /* The following variables are all protected by the STATIC_MASTER
  188.   ** mutex, not by sqlite3.mutex. They are used by code in notify.c.
  189.   **
  190.   ** When X.pUnlockConnection==Y, that means that X is waiting for Y to
  191.   ** unlock so that it can proceed.
  192.   **
  193.   ** When X.pBlockingConnection==Y, that means that something that X tried
  194.   ** tried to do recently failed with an SQLITE_LOCKED error due to locks
  195.   ** held by Y.
  196.   */
  197.   sqlite3 *pBlockingConnection; /* Connection that caused SQLITE_LOCKED */
  198.   sqlite3 *pUnlockConnection;           /* Connection to watch for unlock */
  199.   void *pUnlockArg;                     /* Argument to xUnlockNotify */
  200.   void (*xUnlockNotify)(void **, int);  /* Unlock notify callback */
  201.   sqlite3 *pNextBlocked;        /* Next in list of all blocked connections */
  202. #endif
  203. #ifdef SQLITE_USER_AUTHENTICATION
  204.   sqlite3_userauth auth;        /* User authentication information */
  205. #endif
  206. };
  207.  
  208. /* ------------------------------------------------------------------------------------------------------------------------------------*/
  209.  
  210. struct Instancia sqlite3;
  211.  
  212. int *GetInstancePtr(){
  213.         return *Instancia;
  214. }
  215.  

The function at the end is where I´ll try to send the struct pointer back to the QB64 application to be used.
But QB64 still cant compile it as a .H file cause there are more deftypes out there in the sqlite mess files..

I´will take a look at your code.

Thx!

13
QB64 Discussion / Re: I need some help with Sqlite3 DLL, plz.
« on: October 16, 2018, 03:31:28 pm »
Here is the DLL and the H file.

Code: QB64: [Select]
  1. 'These two simple procedures returns no errors
  2.  
  3.     SUB initSql ALIAS sqlite3_initialize ()
  4.     SUB stopSql ALIAS sqlite3_shutdown ()
  5.    
  6.  

I´m trying to implement this function now, but im getting errors when I try to use it. I guess Im not passing the parameters correctly.

Code: QB64: [Select]
  1. int sqlite3_open(
  2.   const char *filename,   /* Database filename (UTF-8) */
  3.   sqlite3 **ppDb          /* OUT: SQLite db handle */
  4. );
  5.  

14
QB64 Discussion / Re: I need some help with Sqlite3 DLL, plz.
« on: October 16, 2018, 05:35:16 am »
By the way, its better use Dynamic or a Customtype library?

15
QB64 Discussion / I need some help with Sqlite3 DLL, plz.
« on: October 16, 2018, 05:31:32 am »
Hi folks,
Im trying to use Sqlite3 under QB64, I´ve downloaded the DLL and the C++ header (both in the same path as qb64).

I´m reading both the header file and some online material to figure out how to do it.

But I don´t know how to declare the following function (present in the header):

int sqlite3_open(
  const char *filename,   /* Database filename (UTF-8) */
  sqlite3 **ppDb          /* OUT: SQLite db handle */
);

So, *filename is a pointer to the first char in the string? Like " _OFFSET(dbFileName$) for example?
And **ppDb isn´t an input pointer, but it outputs data?

Thanks to everyone!


Pages: [1] 2