home *** CD-ROM | disk | FTP | other *** search
/ Wacky Windows Stuff... / WACKY.iso / toolbook / sql.tbk (.txt) < prev    next >
Asymetrix ToolBook File  |  1992-04-23  |  37KB  |  580 lines

  1.     linkDLL "sql.dll"
  2.         INT SqlCursorClose(WORD, 
  3. POINTER)
  4.  SqlCusrsorOpen(
  5. <DescribeColumn(
  6. ZDescribeTable(
  7. wExecute(
  8. j, STRING)
  9. FetchFirst(
  10. FetchLast(
  11. FetchPrevious(
  12. FetchNext(
  13. FetchPositioned(
  14. , LONG, 
  15. GetStatus(
  16.  SqlLogin(
  17. Logout(
  18. kernel"
  19. gGlobalAlloc(
  20. GlobalLock(
  21. GlobalUnlock(
  22. gGlobalFree(
  23.  GlobalSize(
  24. enterBook
  25. enterBook
  26. sql.dll
  27. SqlCursorClose
  28. SqlCusrsorOpen
  29. SqlDescribeColumn
  30. SqlDescribeTable
  31. SqlExecute
  32. SqlFetchFirst
  33. SqlFetchLast
  34. SqlFetchPrevious
  35. SqlFetchNext
  36. SqlFetchPositioned
  37. SqlGetStatus
  38. SqlLogin
  39. SqlLogout
  40. kernel
  41. GlobalAlloc
  42. GlobalLock
  43. GlobalUnlock
  44. GlobalFree
  45. GlobalSize
  46. System
  47. i, STRING)
  48. FetchFirst(
  49. FetchLast(
  50. FetchPrevious(
  51. FetchNext(
  52. FetchPositioned(
  53. , LONG, 
  54. GetStatus(
  55.  SqlLogin(
  56. Logout(
  57. kernel"
  58. gGlobalAlloc(
  59. GlobalLock(
  60. GlobalUnlock(
  61. gGlobalFree(
  62.  GlobalSize(
  63. -- cover functions 
  64. -- These will have the same 
  65. pwithout 
  66. enterBook
  67. enterBook
  68. sql.dll
  69. SqlCursorClose
  70. SqlCursorOpen
  71. SqlDescribeColumn
  72. SqlDescribeTable
  73. SqlExecute
  74. SqlFetchFirst
  75. SqlFetchLast
  76. SqlFetchPrevious
  77. SqlFetchNext
  78. SqlFetchPositioned
  79. SqlGetStatus
  80. SqlLogin
  81. SqlLogout
  82. kernel
  83. GlobalAlloc
  84. GlobalLock
  85. GlobalUnlock
  86. GlobalFree
  87. GlobalSize
  88. This book contains an example of the Quasar SQL for Windows DLLL
  89. control
  90. Error detail: 
  91. Error Msg: 
  92. Hilite Length: 0
  93. Hilite Offset: 0
  94. Padding: 0
  95. Record Buff. Size: 59
  96. Result Code: 0
  97. Hilite Offset: 0
  98. Padding: 0
  99. Record Buff. Size: 30
  100. Result Code: 69
  101. te Offset: 0
  102. Padding: 0
  103. Record Buff. Size: 52
  104. Result Code: 0
  105. 4loggedIn
  106. FALSE
  107. "Must Log In First"
  108. 4ptrControl, hUser, hCursor
  109. ("Enter SQL Query" 
  110. query
  111. doit     
  112. buttonup
  113. buttonup
  114. Must Log In First
  115. Enter SQL Query
  116. cancel
  117. query
  118. query
  119. ptrControl
  120. hUser
  121. hCursor
  122. loggedIn
  123. Ad Hoc Query
  124. status
  125. Number of Deletes: 0
  126. Number of Inserts: 0
  127. Number of Selects: 6
  128. Number of Updates: 0
  129. Elapsed Time (msec): 160
  130. query
  131. select * from p;
  132. ere 'Rome' =
  133.   (select city from j where j.jno = spj.jno);
  134. select * from spj;
  135. 4hUser, hCursor
  136. login()
  137. CursorOpen(
  138. GetStatus(
  139. buttonup
  140. buttonup
  141. login
  142. CursorOpen
  143. GetStatus
  144. hUser
  145. hCursor
  146. Login
  147. 4hUser
  148. Logout(
  149. buttonup
  150. buttonup
  151. Logout
  152. hUser
  153. logout
  154. 4loggedIn
  155. FALSE
  156. "Must Log In First"
  157. opendlg("c:\temp","*.sql", "Choose a query file...","SQLTBK")
  158. sqlFile 
  159. IsqlFIle 
  160. o(26)
  161. buttonup
  162. buttonup
  163. Must Log In First
  164. c:\temp
  165. *.sql
  166. Choose a query file...
  167. SQLTBK
  168. opendlg
  169. sqlFIle
  170. query
  171. sqlFile
  172. loggedIn
  173. File Query
  174. results
  175. P6    Cog                 Red          19London          
  176. P5    Cam                 Blue         12Paris          
  177. P4    Screw               Red          14London         
  178. P3    Screw               Blue         17Rome           
  179. P2    Bolt                Green        17Paris          
  180. P1    Nut                 Red          12London         
  181. about
  182. buttonUp
  183. buttonUp
  184. This Book is an example of using the QUASAR SQL For Windows API under ToolBook.  This was just writen to see if the two products would integrate. I have not performed all the error checking  I would do in final product nor has it been optimized.
  185. This code has not gone through a formal QA process and is distributed AS IS. Tech Support can NOT assist with this product, but bug reports will be accepted,
  186. This uses the Quasar SQL for Windows Engine from 
  187. Stellar Industries
  188. 3335 S. Falcon Ridge Rd.
  189. Diamond Bar, CA  91765
  190. (714) 861-7885
  191. about
  192. buttonUp
  193. buttonUp
  194. about
  195. :PHYSSIZE
  196. 4cursList, 
  197. 9,12,10,11
  198. results
  199. spin option
  200. athe cursor 
  201. "reset"
  202. k4 + 1) 
  203. 4ptrControl, hUser, hCursor, ptrStatus
  204. stat 
  205. s_execute(
  206. "query")
  207. getStatus (
  208. JHCursor) 
  209. U) > 0
  210. -- did 
  211. table 
  212. DescribeTable(
  213. !>= 1
  214. hrecBuff 
  215. GlobalAlloc(66, 
  216. globalLock(
  217. .(328,
  218. |) -- init control struct
  219. ctrlDump
  220. FetchFirst(
  221. GetStatus(
  222. temp 
  223. 1(0, 
  224. && CRLF
  225. ) - 1)
  226. FetchNext(
  227. 1(0, 
  228. globalUnlock(
  229. globalFree(
  230. terPage
  231. enterPage
  232. enterPage
  233. results
  234. cursList
  235. reset
  236. cursList
  237. option
  238. query
  239. s_execute
  240. HCursor
  241. getStatus
  242. DescribeTable
  243. GlobalAlloc
  244. globalLock
  245. wctrlDump
  246. FetchFirst
  247. GetStatus
  248. FetchNext
  249. GetStatus
  250. globalUnlock
  251. globalFree
  252. reset
  253. results
  254. recBuff
  255. hrecBuff
  256. table
  257. ptrControl
  258. hUser
  259. hCursor
  260. ptrStatus
  261. 4hControl, ptrControl, hColumn, ptrColumn, hTable, ptrTable, hStatus, ptrStatus
  262. e"About SQL.TBK" 
  263. c"Help" 
  264. "dba.exe" 
  265. "The Quasar Database Administrator could 
  266. xbe loaded" & CRLF &\
  267.         "Run DBA.EXE 
  268. 4attempting access"
  269.     linkDLL "c:\
  270. $\sql.dll"
  271.         INT SqlCursorClose(WORD, 
  272. POINTER)
  273.  SqlCursorOpen(
  274. ;DescribeColumn(
  275. YDescribeTable(
  276. vExecute(
  277. i, STRING)
  278. FetchFirst(
  279. ]pointers instead 
  280. strings
  281. FetchLast(
  282. the fetches because 
  283. FetchPrevious(
  284. -- buffer 
  285. explicitly allocated
  286. FetchNext(
  287. FetchPositioned(
  288. , LONG, 
  289. GetStatus(
  290.  SqlLogin(
  291. Logout(
  292. kernel"
  293. gGlobalAlloc(
  294. GlobalLock(
  295. GlobalUnlock(
  296. gGlobalFree(
  297.  GlobalSize(
  298. tbkdlg.
  299.  opendlg(
  300. globalAlloc(66,358)
  301. globalLock(
  302.  table    
  303.  descriptor
  304. -- cover functions 
  305. -- These will have 
  306. same 
  307. pwithout 
  308. 'Sql'
  309. aboutSQLTBK
  310. loggedIn
  311. ("User Name" 
  312. f"SYSTEM"
  313. uname 
  314. ("Password" 
  315. f"QUASAR"
  316. userHandle 
  317. ?,pw)
  318. ctrlDump
  319.  Failed"
  320. "failed"
  321.  hUser
  322. stat 
  323. SqlLogout(
  324. FALSE
  325. "control" 
  326.     "Error detail:"&& 
  327.  Msg:"&& 
  328. 1(66,
  329.     "Hilite Length:"&& 
  330. .(322,
  331. #Offset:"&& 
  332. .(324,
  333.     "Padding:" && 
  334. .(326, 
  335.     "Record Buff. 
  336. :" && 
  337. .(328, 
  338.     "Result Code:" && 
  339. .(330,
  340. cursorHandle 
  341. , hCursor
  342. SqlDescribeTable(
  343.  -- record 
  344. , colNumber
  345. SqlDescribeColumn(
  346. S_execute 
  347. , query
  348. SqlExecute(
  349. SqlFetchFirst(
  350. SqlFetchLast(
  351. SqlFetchNext(
  352. , pos,
  353. , hCusrsor, 
  354. SqlFetchPrevious(
  355. SqlGetStatus(
  356. "status" 
  357. Deletes:"&& 
  358. Inserts:"&& 
  359. Selects:"&& 
  360. Updates:"&& 
  361. /(12,
  362.         "Elapsed Time (msec):" && 
  363. /(16,
  364. globalUnlock (
  365. globalFree
  366. aboutSQLTBK
  367. enterBook
  368. ctrlDump
  369. leaveBook
  370. CursorOpen
  371. DescribeColumn
  372. S_execute
  373. Logout
  374. FetchFirst
  375. CursorClose
  376. FetchLast
  377. FetchNext
  378. Login
  379. FetchPosition
  380. DescribeTable
  381. FetchPrevious
  382. GetStatus
  383. enterBook
  384. About SQL.TBK
  385. dba.exe
  386. The Quasar Database Administrator could not be loaded
  387. Run DBA.EXE before attempting access
  388. c:\temp\sql.dll
  389. SqlCursorClose
  390. SqlCursorOpen
  391. SqlDescribeColumn
  392. SqlDescribeTable
  393. SqlExecute
  394. SqlFetchFirst
  395. SqlFetchLast
  396. SqlFetchPrevious
  397. SqlFetchNext
  398. SqlFetchPositioned
  399. SqlGetStatus
  400. SqlLogin
  401. SqlLogout
  402. kernel
  403. GlobalAlloc
  404. GlobalLock
  405. GlobalUnlock
  406. GlobalFree
  407. GlobalSize
  408. tbkdlg.dll
  409. opendlg
  410.                     q
  411. globalAlloc
  412. globalLock
  413. globalAlloc
  414. globalLock
  415. globalAlloc
  416. globalLock
  417. globalAlloc
  418. globalLock
  419. hControl
  420. ptrControl
  421. hColumn
  422. ptrColumn
  423. hTable
  424. ptrTable
  425. hStatus
  426. ptrStatus
  427. aboutSQLTBK
  428. about
  429. Login
  430. User Name
  431. SYSTEM
  432. Password
  433. QUASAR
  434. SqlLogin
  435. wctrlDump
  436. Login Failed
  437. failed
  438. userHandle
  439. uname
  440. ptrControl
  441. loggedIn
  442. Logout
  443. SqlLogout
  444. wctrlDump
  445. Logout Failed
  446. failed
  447. userHandle
  448. ptrControl
  449. loggedIn
  450. hUser
  451. ctrlDump
  452. control
  453. Error detail:
  454. Error Msg:
  455. Hilite Length:
  456. Hilite Offset:
  457. Padding:
  458. Record Buff. Size:
  459. Result Code:
  460. ptrControl
  461. CursorOpen
  462. SqlCursorOpen
  463. wctrlDump
  464. CursorOpen Failed
  465. failed
  466. cursorHandle
  467. ptrControl
  468. hUser
  469. CursorClose
  470. SqlCursorClose
  471. wctrlDump
  472. CursorClose Failed
  473. failed
  474. cursorHandle
  475. ptrControl
  476. hCursor
  477. hUser
  478. DescribeTable
  479. SqlDescribeTable
  480. wctrlDump
  481. DescribeTable Failed
  482. failed
  483. ptrControl
  484. ptrTable
  485. hCursor
  486. hUser
  487. DescribeColumn
  488. SqlDescribeColumn
  489. wctrlDump
  490. DescribeColumn Failed
  491. failed
  492. ptrControl
  493. ptrColumn
  494. colNumber
  495. hCursor
  496. hUser
  497. S_execute
  498. SqlExecute
  499. wctrlDump
  500. S_execute Failed
  501. failed
  502. ptrControl
  503. query
  504. hCursor
  505. hUser
  506. FetchFirst
  507. SqlFetchFirst
  508. wctrlDump
  509.  FetchFirst Failed
  510. failed
  511. ptrControl
  512. buffer
  513. hCursor
  514. hUser
  515. FetchLast
  516. SqlFetchLast
  517. wctrlDump
  518.  FetchLast Failed
  519. failed
  520. ptrControl
  521. buffer
  522. hCursor
  523. hUser
  524. FetchNext
  525. SqlFetchNext
  526. wctrlDump
  527.  FetchNext Failed
  528. failed
  529. ptrControl
  530. buffer
  531. hCursor
  532. hUser
  533. FetchPosition
  534. SqlFetchFirst
  535. wctrlDump
  536.  FetchPosition Failed
  537. failed
  538. ptrControl
  539. buffer
  540. hCursor
  541. hUser
  542. FetchPrevious
  543. SqlFetchPrevious
  544. wctrlDump
  545.  FetchPrevious Failed
  546. failed
  547. hCursor
  548. ptrControl
  549. buffer
  550. hCusrsor
  551. hUser
  552. GetStatus
  553. SqlGetStatus
  554. wctrlDump
  555.  GetStatus Failed
  556. failed
  557. status
  558. Number of Deletes:
  559. Number of Inserts:
  560. Number of Selects:
  561. Number of Updates:
  562. Elapsed Time (msec):
  563. ptrControl
  564. ptrStatus
  565. hCursor
  566. hUser
  567. leaveBook
  568. globalUnlock
  569. globalFree
  570. globalUnlock
  571. globalFree
  572. globalUnlock
  573. globalFree
  574. globalUnlock
  575. globalFree
  576. hControl
  577. hColumn
  578. hTable
  579. hStatus
  580.