fireruby 0.1.0-powerpc-darwin → 0.2.0-powerpc-darwin

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. data/doc/README +297 -31
  2. data/examples/example01.rb +60 -0
  3. data/lib/doc.tar.gz +0 -0
  4. data/lib/fireruby.bundle +0 -0
  5. data/lib/mkdoc +1 -1
  6. data/lib/src.rb +158 -15
  7. data/test/ConnectionTest.rb +11 -10
  8. data/test/DDLTest.rb +7 -6
  9. data/test/DatabaseTest.rb +13 -14
  10. data/test/GeneratorTest.rb +4 -3
  11. data/test/ResultSetTest.rb +6 -5
  12. data/test/RowTest.rb +49 -0
  13. data/test/SQLTest.rb +43 -26
  14. data/test/StatementTest.rb +6 -5
  15. data/test/TransactionTest.rb +7 -6
  16. data/test/UnitTest.rb +1 -0
  17. metadata +11 -135
  18. data/doc/CVS/Entries +0 -10
  19. data/doc/CVS/Repository +0 -1
  20. data/doc/CVS/Root +0 -1
  21. data/doc/classes/CVS/Entries +0 -2
  22. data/doc/classes/CVS/Entries.Log +0 -1
  23. data/doc/classes/CVS/Repository +0 -1
  24. data/doc/classes/CVS/Root +0 -1
  25. data/doc/classes/FireRuby/CVS/Entries +0 -8
  26. data/doc/classes/FireRuby/CVS/Entries.Log +0 -7
  27. data/doc/classes/FireRuby/CVS/Repository +0 -1
  28. data/doc/classes/FireRuby/CVS/Root +0 -1
  29. data/doc/classes/FireRuby/Connection.html +0 -364
  30. data/doc/classes/FireRuby/Connection.src/CVS/Entries +0 -10
  31. data/doc/classes/FireRuby/Connection.src/CVS/Repository +0 -1
  32. data/doc/classes/FireRuby/Connection.src/CVS/Root +0 -1
  33. data/doc/classes/FireRuby/Connection.src/M000046.html +0 -17
  34. data/doc/classes/FireRuby/Connection.src/M000047.html +0 -17
  35. data/doc/classes/FireRuby/Connection.src/M000048.html +0 -17
  36. data/doc/classes/FireRuby/Connection.src/M000049.html +0 -17
  37. data/doc/classes/FireRuby/Connection.src/M000050.html +0 -17
  38. data/doc/classes/FireRuby/Connection.src/M000051.html +0 -17
  39. data/doc/classes/FireRuby/Connection.src/M000052.html +0 -18
  40. data/doc/classes/FireRuby/Connection.src/M000053.html +0 -18
  41. data/doc/classes/FireRuby/Connection.src/M000054.html +0 -18
  42. data/doc/classes/FireRuby/Database.html +0 -292
  43. data/doc/classes/FireRuby/Database.src/CVS/Entries +0 -7
  44. data/doc/classes/FireRuby/Database.src/CVS/Repository +0 -1
  45. data/doc/classes/FireRuby/Database.src/CVS/Root +0 -1
  46. data/doc/classes/FireRuby/Database.src/M000035.html +0 -17
  47. data/doc/classes/FireRuby/Database.src/M000036.html +0 -17
  48. data/doc/classes/FireRuby/Database.src/M000037.html +0 -17
  49. data/doc/classes/FireRuby/Database.src/M000038.html +0 -18
  50. data/doc/classes/FireRuby/Database.src/M000039.html +0 -17
  51. data/doc/classes/FireRuby/Database.src/M000040.html +0 -17
  52. data/doc/classes/FireRuby/FireRubyError.html +0 -221
  53. data/doc/classes/FireRuby/FireRubyError.src/CVS/Entries +0 -6
  54. data/doc/classes/FireRuby/FireRubyError.src/CVS/Repository +0 -1
  55. data/doc/classes/FireRuby/FireRubyError.src/CVS/Root +0 -1
  56. data/doc/classes/FireRuby/FireRubyError.src/M000041.html +0 -17
  57. data/doc/classes/FireRuby/FireRubyError.src/M000042.html +0 -17
  58. data/doc/classes/FireRuby/FireRubyError.src/M000043.html +0 -17
  59. data/doc/classes/FireRuby/FireRubyError.src/M000044.html +0 -17
  60. data/doc/classes/FireRuby/FireRubyError.src/M000045.html +0 -17
  61. data/doc/classes/FireRuby/Generator.html +0 -343
  62. data/doc/classes/FireRuby/Generator.src/CVS/Entries +0 -9
  63. data/doc/classes/FireRuby/Generator.src/CVS/Repository +0 -1
  64. data/doc/classes/FireRuby/Generator.src/CVS/Root +0 -1
  65. data/doc/classes/FireRuby/Generator.src/M000001.html +0 -17
  66. data/doc/classes/FireRuby/Generator.src/M000002.html +0 -17
  67. data/doc/classes/FireRuby/Generator.src/M000003.html +0 -17
  68. data/doc/classes/FireRuby/Generator.src/M000004.html +0 -17
  69. data/doc/classes/FireRuby/Generator.src/M000005.html +0 -17
  70. data/doc/classes/FireRuby/Generator.src/M000006.html +0 -17
  71. data/doc/classes/FireRuby/Generator.src/M000007.html +0 -17
  72. data/doc/classes/FireRuby/Generator.src/M000008.html +0 -17
  73. data/doc/classes/FireRuby/ResultSet.html +0 -343
  74. data/doc/classes/FireRuby/ResultSet.src/CVS/Entries +0 -10
  75. data/doc/classes/FireRuby/ResultSet.src/CVS/Repository +0 -1
  76. data/doc/classes/FireRuby/ResultSet.src/CVS/Root +0 -1
  77. data/doc/classes/FireRuby/ResultSet.src/M000026.html +0 -17
  78. data/doc/classes/FireRuby/ResultSet.src/M000027.html +0 -17
  79. data/doc/classes/FireRuby/ResultSet.src/M000028.html +0 -17
  80. data/doc/classes/FireRuby/ResultSet.src/M000029.html +0 -17
  81. data/doc/classes/FireRuby/ResultSet.src/M000030.html +0 -17
  82. data/doc/classes/FireRuby/ResultSet.src/M000031.html +0 -17
  83. data/doc/classes/FireRuby/ResultSet.src/M000032.html +0 -17
  84. data/doc/classes/FireRuby/ResultSet.src/M000033.html +0 -17
  85. data/doc/classes/FireRuby/ResultSet.src/M000034.html +0 -17
  86. data/doc/classes/FireRuby/Statement.html +0 -349
  87. data/doc/classes/FireRuby/Statement.src/CVS/Entries +0 -10
  88. data/doc/classes/FireRuby/Statement.src/CVS/Repository +0 -1
  89. data/doc/classes/FireRuby/Statement.src/CVS/Root +0 -1
  90. data/doc/classes/FireRuby/Statement.src/M000017.html +0 -17
  91. data/doc/classes/FireRuby/Statement.src/M000018.html +0 -17
  92. data/doc/classes/FireRuby/Statement.src/M000019.html +0 -17
  93. data/doc/classes/FireRuby/Statement.src/M000020.html +0 -17
  94. data/doc/classes/FireRuby/Statement.src/M000021.html +0 -17
  95. data/doc/classes/FireRuby/Statement.src/M000022.html +0 -17
  96. data/doc/classes/FireRuby/Statement.src/M000023.html +0 -18
  97. data/doc/classes/FireRuby/Statement.src/M000024.html +0 -18
  98. data/doc/classes/FireRuby/Statement.src/M000025.html +0 -17
  99. data/doc/classes/FireRuby/Transaction.html +0 -484
  100. data/doc/classes/FireRuby/Transaction.src/CVS/Entries +0 -9
  101. data/doc/classes/FireRuby/Transaction.src/CVS/Repository +0 -1
  102. data/doc/classes/FireRuby/Transaction.src/CVS/Root +0 -1
  103. data/doc/classes/FireRuby/Transaction.src/M000009.html +0 -17
  104. data/doc/classes/FireRuby/Transaction.src/M000010.html +0 -17
  105. data/doc/classes/FireRuby/Transaction.src/M000011.html +0 -17
  106. data/doc/classes/FireRuby/Transaction.src/M000012.html +0 -17
  107. data/doc/classes/FireRuby/Transaction.src/M000013.html +0 -17
  108. data/doc/classes/FireRuby/Transaction.src/M000014.html +0 -17
  109. data/doc/classes/FireRuby/Transaction.src/M000015.html +0 -18
  110. data/doc/classes/FireRuby/Transaction.src/M000016.html +0 -17
  111. data/doc/classes/FireRuby.html +0 -116
  112. data/doc/created.rid +0 -1
  113. data/doc/files/CVS/Entries +0 -2
  114. data/doc/files/CVS/Repository +0 -1
  115. data/doc/files/CVS/Root +0 -1
  116. data/doc/files/src_rb.html +0 -119
  117. data/doc/fr_class_index.html +0 -34
  118. data/doc/fr_file_index.html +0 -27
  119. data/doc/fr_method_index.html +0 -80
  120. data/doc/index.html +0 -24
  121. data/doc/rdoc-style.css +0 -175
  122. data/test/example.c +0 -91
  123. data/test/fb.c +0 -297
  124. data/test/mfb +0 -1
  125. data/test/sql_unit_test.fdb +0 -0
  126. data/test/test.fdb +0 -0
data/test/example.c DELETED
@@ -1,91 +0,0 @@
1
- #include <ibase.h>
2
-
3
- #define LASTLEN 20
4
- #define FIRSTLEN 15
5
- #define EXTLEN 4
6
-
7
- typedef struct vary
8
- {
9
- short vary_length;
10
- char vary_string[1];
11
- } VARY;
12
-
13
- ISC_STATUS status_vector[20],
14
- retcode;
15
- long SQLCODE;
16
- XSQLDA *osqlda;
17
- XSQLVAR *ovar;
18
- short flag0,
19
- flag1,
20
- flag2;
21
- char *str = "SELECT last_name, first_name, phone_ext FROM phone_list "\
22
- "WHERE location = "Monterey" ORDER BY last_name, first_name";
23
- char last_name[LASTLEN + 2];
24
- char first_name[FIRSTLEN + 2];
25
- char phone_ext[EXTLEN + 2];
26
- VARY *vary;
27
-
28
- /* Allocate an output XSQLDA osqlda. */
29
- osqlda = (XSQLDA *)malloc(XSQLDA_LENGTH(3);
30
- osqlda->version = SQLDA_VERSION1;
31
- osqlda->sqln = 3;
32
-
33
- /* Prepare the statement. */
34
- isc_dsql_prepare(status_vector,
35
- &tr_handle, /* Set in previous isc_start_transaction() call. */
36
- &stmt_handle, /* Allocated previously by isc_dsql_allocate_statement() or isc_dsql_alloc_statement2() call. */
37
- 0,
38
- str,
39
- 1,
40
- osqlda);
41
-
42
- if (status_vector[0] == 1 && status_vector[1])
43
- {
44
- /* Process error. */
45
- isc_print_status(status_vector);
46
- return(1);
47
- }
48
-
49
- /* Set up an output XSQLVAR structure to allocate space for each item to be returned. */
50
- osqlda->sqlvar[0].sqldata = last_name;
51
- osqlda->sqlvar[0].sqltype = SQL_VARYING + 1;
52
- osqlda->sqlvar[0].sqlind = &flag0;
53
- osqlda->sqlvar[1].sqldata = first_name;
54
- osqlda->sqlvar[1].sqltype = SQL_VARYING + 1;
55
- osqlda->sqlvar[1].sqlind = &flag1;
56
- osqlda->sqlvar[2].sqldata = phone_ext;
57
- osqlda->sqlvar[2].sqltype = SQL_VARYING + 1;
58
- osqlda->sqlvar[2].sqlind = &flag2;
59
-
60
- /* Execute the statement. */
61
- isc_dsql_execute(status_vector,
62
- &tr_handle, /* Set in previous isc_start_transaction() call. */
63
- &stmt_handle, /* Allocated previously by isc_dsql_allocate_statement() or isc_dsql_alloc_statement2() call. */
64
- 1,
65
- NULL);
66
-
67
- if (status_vector[0] == 1 && status_vector[1])
68
- {
69
- /* Process error. */
70
- isc_print_status(status_vector);
71
- return(1);
72
- }
73
-
74
- printf("\n%-20s %-15s %-10s\n\n", "LAST NAME", "FIRST NAME", "EXTENSION");
75
-
76
- /* Fetch and print the records in the select list one by one. */
77
- while((retcode = isc_dsql_fetch( status_vector, &stmt_handle, 1, osqlda)) == 0)
78
- {
79
- vary = (VARY *)last_name;
80
- printf("%-20.*s ", vary->vary_length, vary->vary_string);
81
- vary = (VARY *)first_name;
82
- printf("%-15.*s ", vary->vary_length, vary->vary_string);
83
- vary = (VARY *)phone_ext;
84
- printf("%-4.*s ", vary->vary_length, vary->vary_string);
85
- }
86
-
87
- if(retcode != 100L)
88
- {
89
- SQLCODE = isc_sqlcode(status_vector);
90
- isc_print_sqlerror(SQLCODE, status_vector); return(1);
91
- }
data/test/fb.c DELETED
@@ -1,297 +0,0 @@
1
- #include <stdio.h>
2
- #include <string.h>
3
- #include "ibase.h"
4
-
5
- long *buffer;
6
- unsigned int buffer_size;
7
-
8
- void writeError(ISC_STATUS *);
9
- void prepareXSQLDA(XSQLDA *);
10
- unsigned int calculateSize(XSQLDA *);
11
- void writeBuffer(void *, unsigned int);
12
-
13
- #define USERNAME "sysdba"
14
- #define PASSWORD "masterkey"
15
- #define DATABASE "./test.fdb"
16
- #define SQL "SELECT * FROM USERS"
17
- #define ALIGN(ptr, n) ((ptr + n - 1) & ~(n - 1))
18
-
19
- int main(void)
20
- {
21
- char dpb[100],
22
- *location = dpb;
23
- isc_db_handle db = 0;
24
- short size = 0;
25
- ISC_STATUS status[20];
26
- unsigned int length = 0;
27
-
28
- /* Prepare the DPB and connect to the database. */
29
- memset(dpb, 0, 100);
30
- *location++ = isc_dpb_version1;
31
-
32
- size = strlen(USERNAME);
33
- *location++ = isc_dpb_user_name;
34
- *location++ = (char)size;
35
- memcpy(location, USERNAME, size);
36
- location += size;
37
-
38
- size = strlen(PASSWORD);
39
- *location++ = isc_dpb_password;
40
- *location++ = (char)size;
41
- memcpy(location, PASSWORD, size);
42
- location += size;
43
-
44
- length = strlen(USERNAME) + strlen(PASSWORD) + 5;
45
- if(isc_attach_database(status, strlen(DATABASE), DATABASE, &db,
46
- length, dpb) == 0)
47
- {
48
- isc_tr_handle tr = 0;
49
-
50
- /* Start a transaction. */
51
- if(isc_start_transaction(status, &tr, 1, &db, 0, NULL) == 0)
52
- {
53
- isc_stmt_handle stmt = 0;
54
-
55
- /* Create a SQL statment. */
56
- if(isc_dsql_allocate_statement(status, &db, &stmt) == 0)
57
- {
58
- XSQLDA *da = (XSQLDA *)malloc(XSQLDA_LENGTH(3));
59
-
60
- /* Prepare the statement for execution. */
61
- if(da != NULL)
62
- {
63
- da->version = SQLDA_VERSION1;
64
- da->sqln = 3;
65
- if(isc_dsql_prepare(status, &tr, &stmt, 0, SQL, 3, da) == 0)
66
- {
67
- XSQLDA *actual = NULL;
68
-
69
- /* Check if the XSQLDA needs resizing. */
70
- if(da->sqld > da->sqln)
71
- {
72
- /* Allocate the new XSQLDA. */
73
- actual = (XSQLDA *)malloc(XSQLDA_LENGTH(da->sqld));
74
- if(actual != NULL)
75
- {
76
- /* Bind the details to the new XSQLDA. */
77
- actual->version = SQLDA_VERSION1;
78
- actual->sqln = da->sqld;
79
- if(isc_dsql_describe(status, &stmt, SQL_DIALECT_V6,
80
- actual) != 0)
81
- {
82
- /* Print an error. */
83
- fprintf(stderr, "DSQL describe call failed.\n");
84
- writeError(status);
85
- }
86
- else
87
- {
88
- /* Slot the new XSQLDA into place. */
89
- free(da);
90
- printf("Assigning updated XSQLDA (%p).\n", actual);
91
- da = actual;
92
- }
93
- }
94
- else
95
- {
96
- /* Print an error message. */
97
- fprintf(stderr, "Error resizing XSQLDA.");
98
- }
99
- }
100
-
101
- /* Prepare the XSQLDA for use. */
102
- prepareXSQLDA(da);
103
-
104
- /* Execute the statement. */
105
- fprintf(stderr, "Calling isc_dsql_execute().\n");
106
- if(isc_dsql_execute(status, &tr, &stmt, SQL_DIALECT_V6,
107
- NULL) == 0)
108
- {
109
- /* Fetch a row of data. */
110
- fprintf(stderr, "Calling isc_dsql_fetch().\n");
111
- if(isc_dsql_fetch(status, &stmt, SQL_DIALECT_V6, da) != 0)
112
- {
113
- /* Print an error. */
114
- fprintf(stderr, "Error performing SQL fetch.\n");
115
- writeError(status);
116
- }
117
- else
118
- {
119
- writeBuffer(buffer, sizeof(long) * buffer_size);
120
- }
121
- }
122
- else
123
- {
124
- /* Print an error. */
125
- fprintf(stderr, "Error executing the SQL statement.\n");
126
- writeError(status);
127
- }
128
-
129
- /* Free the XQSLDA memory. */
130
- free(da);
131
- }
132
- else
133
- {
134
- /* Print an error and rollback the transaction. */
135
- fprintf(stderr, "Error preparing the SQL statement.\n");
136
- isc_rollback_transaction(status, &tr);
137
- }
138
- }
139
-
140
- /* Release the statement resources. */
141
- isc_dsql_free_statement(status, &stmt, DSQL_drop);
142
- }
143
- else
144
- {
145
- /* Print an error and rollback the transaction. */
146
- fprintf(stderr, "Error allocating the SQL statement.\n");
147
- isc_rollback_transaction(status, &tr);
148
- }
149
- }
150
- else
151
- {
152
- /* Print an error. */
153
- fprintf(stderr, "Error starting a transaction.\n");
154
- }
155
-
156
- /* Close the database. */
157
- isc_detach_database(status, &db);
158
- printf("Database closed, program exiting.\n");
159
- }
160
- else
161
- {
162
- /* Print an error. */
163
- fprintf(stderr, "Error connecting as %s/%s to the '%s' database.\n",
164
- USERNAME, PASSWORD, DATABASE);
165
- }
166
-
167
- return(0);
168
- }
169
-
170
-
171
- void writeError(ISC_STATUS *status)
172
- {
173
- if(status != NULL && (status[0] == 1 && status[1] != 0))
174
- {
175
- char text[1024];
176
- ISC_STATUS local[20];
177
- long code = 0;
178
-
179
- while(isc_interprete(text, &status))
180
- {
181
- fprintf(stderr, "%s\n", text);
182
- }
183
- code = isc_sqlcode(local);
184
- isc_sql_interprete(code, text, 1024);
185
- fprintf(stderr, "%s\n", text);
186
- }
187
- else
188
- {
189
- /* Write a simple message. */
190
- printf("No error details available.\n");
191
- }
192
- }
193
-
194
-
195
- void prepareXSQLDA(XSQLDA *da)
196
- {
197
- XSQLVAR *var = da->sqlvar;
198
- int error = 0,
199
- offset = 0,
200
- length = 0,
201
- align = 0;
202
- short i;
203
-
204
- buffer = (long *)malloc(sizeof(long) * calculateSize(da));
205
- printf("Received %p for preparation.\n", da);
206
- for(i = 0; i < da->sqln && error == 0; i++, var++)
207
- {
208
- int type = (var->sqltype & ~1);
209
-
210
- length = align = var->sqllen;
211
- switch(type)
212
- {
213
- case SQL_TEXT : /* Type: CHAR */
214
- printf("Allocating memory for a CHAR (%d chars).\n", var->sqllen);
215
- align = 1;
216
- break;
217
-
218
- case SQL_VARYING :
219
- printf("Allocating memory for a VARCHAR (%d chars).\n", var->sqllen);
220
- length += sizeof(short) + 1;
221
- align = sizeof(short);
222
- break;
223
- } /* End of switch. */
224
-
225
- /* Assign data pointers, correcting for alignment. */
226
- offset = FB_ALIGN(offset, align);
227
- var->sqldata = (char *)buffer + offset;
228
- offset += length;
229
- offset = FB_ALIGN(offset, sizeof(short));
230
- var->sqlind = (short *)((char *)buffer + offset);
231
- offset += sizeof(short);
232
- } /* End of for loop. */
233
- }
234
-
235
-
236
- unsigned int calculateSize(XSQLDA *da)
237
- {
238
- unsigned int size = 0;
239
- long total = 0;
240
- int align,
241
- length,
242
- i;
243
- XSQLVAR *var = da->sqlvar;
244
-
245
- for(i = 0; i < da->sqln; i++, var++)
246
- {
247
- int type = (var->sqltype & ~1);
248
-
249
- align = var->sqllen;
250
- switch(type)
251
- {
252
- case SQL_TEXT :
253
- align = 1;
254
- break;
255
-
256
- case SQL_VARYING :
257
- align = sizeof(short);
258
- length = var->sqllen + sizeof(short) + 1;
259
- break;
260
-
261
- default :
262
- length = var->sqllen;
263
- }
264
- total = FB_ALIGN(total, align);
265
- total += length;
266
- total = FB_ALIGN(total, sizeof(short));
267
- total += sizeof(short);
268
- }
269
-
270
- size = (unsigned int)(total / sizeof(long));
271
- if(total % sizeof(long) > 0)
272
- {
273
- size++;
274
- }
275
-
276
- printf("%d bytes (%d longs) required for storage.\n", total, size);
277
- buffer_size = size;
278
- return(size);
279
- }
280
-
281
-
282
- void writeBuffer(void *buffer, unsigned int length)
283
- {
284
- char *offset = (char *)buffer;
285
- unsigned int i;
286
-
287
- for(i = 0; i < length; i++, offset++)
288
- {
289
- if(*offset < 32)
290
- printf(".");
291
- else
292
- printf("%c", *offset);
293
- if(i % 50 == 0)
294
- printf("\n");
295
- }
296
- printf("\n");
297
- }
data/test/mfb DELETED
@@ -1 +0,0 @@
1
- gcc -g -o fb fb.c -framework Firebird -I/Library/Frameworks/Firebird.framework/Headers
Binary file
data/test/test.fdb DELETED
Binary file