ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/PApp-SQL/SQL.xs
(Generate patch)

Comparing PApp-SQL/SQL.xs (file contents):
Revision 1.25 by root, Sat Jul 28 13:51:20 2012 UTC vs.
Revision 1.30 by root, Mon Jun 24 19:24:01 2019 UTC

144mc_cache (mc_node *mc, SV **method, const char *name) 144mc_cache (mc_node *mc, SV **method, const char *name)
145{ 145{
146 *method = (SV *)gv_fetchmethod_autoload (mc->stash, name, 0); 146 *method = (SV *)gv_fetchmethod_autoload (mc->stash, name, 0);
147 147
148 if (!method) 148 if (!method)
149 croak ("%s: method not found in stash, pelase report.", name); 149 croak ("%s: method not found in stash, please report.", name);
150} 150}
151 151
152#define mc_cache(mc, method) mc_cache ((mc), &((mc)->method), # method) 152#define mc_cache(mc, method) mc_cache ((mc), &((mc)->method), # method)
153 153
154typedef struct lru_node 154typedef struct lru_node
177static U32 177static U32
178lru_hash (SV *dbh, SV *sql) 178lru_hash (SV *dbh, SV *sql)
179{ 179{
180 STRLEN i, l; 180 STRLEN i, l;
181 char *b = SvPV (sql, l); 181 char *b = SvPV (sql, l);
182 U32 hash = 2166136261; 182 U32 hash = 2166136261U;
183 183
184 hash = (hash ^ (U32)dbh) * 16777619U; 184 hash = (hash ^ (U32)dbh) * 16777619U;
185 hash = (hash ^ l) * 16777619U; 185 hash = (hash ^ l) * 16777619U;
186 186
187 /* start hashing at char 8, as this skips the "select " prefix */
187 for (i = 7; i < l; i += i >> 2) 188 for (i = 7; i < l; i += i >> 2)
188 hash = (hash ^ b [i]) * 16777619U; 189 hash = (hash ^ b [i]) * 16777619U;
189 190
190 return hash; 191 return hash;
191} 192}
334 335
335void 336void
336sql_exec(...) 337sql_exec(...)
337 ALIAS: 338 ALIAS:
338 sql_uexec = 1 339 sql_uexec = 1
339 sql_fetch = 2 340 sql_fetch = 2
340 sql_ufetch = 3 341 sql_ufetch = 3
341 sql_fetchall = 4 342 sql_fetchall = 4
342 sql_ufetchall = 5 343 sql_ufetchall = 5
343 sql_exists = 6 344 sql_exists = 6
344 sql_uexists = 7 345 sql_uexists = 7
348 croak ("Usage: sql_exec [database-handle,] [bind-var-refs,... ] \"sql-statement\", [arguments, ...]"); 349 croak ("Usage: sql_exec [database-handle,] [bind-var-refs,... ] \"sql-statement\", [arguments, ...]");
349 else 350 else
350 { 351 {
351 int i; 352 int i;
352 int arg = 0; 353 int arg = 0;
353 int first_execution = 0;
354 int bind_first, bind_last; 354 int bind_first, bind_last;
355 int count; 355 int count;
356 lru_node *lru; 356 lru_node *lru;
357 SV *dbh = ST(0); 357 SV *dbh = ST(0);
358 SV *sth; 358 SV *sth;
485 485
486 PUSHMARK (SP); 486 PUSHMARK (SP);
487 EXTEND (SP, 4); 487 EXTEND (SP, 4);
488 PUSHs (sth); 488 PUSHs (sth);
489 SvIVX (tmp_iv)++; 489 SvIVX (tmp_iv)++;
490 SvIOK_only (tmp_iv);
490 PUSHs (tmp_iv); 491 PUSHs (tmp_iv);
491 PUSHs (sv); 492 PUSHs (sv);
492 493
493 PUSHs ( 494 PUSHs (
494 SvPOKp (sv) ? sql_varchar 495 SvPOKp (sv) ? sql_varchar
522 EXTEND (SP, items - arg + 1); 523 EXTEND (SP, items - arg + 1);
523 PUSHs (sth); 524 PUSHs (sth);
524 while (items > arg) 525 while (items > arg)
525 { 526 {
526 SV *sv = ST (arg); 527 SV *sv = ST (arg);
527 PUSHs (ST (arg)); 528 PUSHs (sv);
528 arg++; 529 arg++;
529 } 530 }
530 } 531 }
531 532
532 PUTBACK; 533 PUTBACK;
617 case G_VOID: 618 case G_VOID:
618 /* no thing */ 619 /* no thing */
619 break; 620 break;
620 case G_SCALAR: 621 case G_SCALAR:
621 /* the first element */ 622 /* the first element */
622 XPUSHs (mortalcopy_and_maybe_force_utf8 (ix & 1, *av_fetch ((AV *)SvRV (row), 0, 1))); 623 XPUSHs (mortalcopy_and_maybe_force_utf8 (ix & 1, AvARRAY ((AV *)SvRV (row))[0]));
623 count = 1; 624 count = 1;
624 break; 625 break;
625 case G_ARRAY: 626 case G_ARRAY:
626 av = (AV *)SvRV (row); 627 av = (AV *)SvRV (row);
627 count = AvFILL (av) + 1; 628 count = AvFILL (av) + 1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines